Compare commits

..

1 Commits

Author SHA1 Message Date
mycodedoesnotcompile2
c146c36c53
Merge 20e2679dbd into 0cd9fd70cb 2025-06-03 18:17:31 +00:00
4 changed files with 4 additions and 34 deletions

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"net/http"
"sync"
"github.com/medium.rip/api/routes"
@ -33,10 +32,6 @@ func RegisterRoutes(ctx context.Context, wg *sync.WaitGroup, engine *html.Engine
Browse: config.Conf.Env == "dev",
}))
if config.Conf.Proxy != "" {
log.Printf("Using proxy: %s", config.Conf.Proxy)
}
routes.RegisterRoutes(app)
go func(app *fiber.App) {

View File

@ -17,7 +17,6 @@ type Config struct {
S3Endpoint string `koanf:"S3_ENDPOINT"`
Env string `koanf:"ENV"`
SecretKey string `koanf:"SECRET_KEY"`
Proxy string `koanf:"PROXY"`
}
var Conf *Config

View File

@ -6,8 +6,6 @@ import (
"net/http"
"os"
"strings"
"net/url"
"crypto/tls"
log "github.com/sirupsen/logrus"
@ -32,35 +30,13 @@ func PostData(postId string) (*entities.MediumResponse, error) {
}
// http client to post data
urlreq := "https://medium.com/_/graphql"
url := "https://medium.com/_/graphql"
method := "POST"
payload := strings.NewReader(fmt.Sprintf("{\"query\":\"query {\\n post(id: \\\"%s\\\") {\\n title\\n createdAt\\n creator {\\n id\\n name\\n }\\n content {\\n bodyModel {\\n paragraphs {\\n name\\n text\\n type\\n href\\n layout\\n markups {\\n title\\n type\\n href\\n userId\\n start\\n end\\n anchorType\\n }\\n iframe {\\n mediaResource {\\n href\\n iframeSrc\\n iframeWidth\\n iframeHeight\\n }\\n }\\n metadata {\\n id\\n originalWidth\\n originalHeight\\n }\\n }\\n }\\n }\\n }\\n }\",\"variables\":{}}", postId))
//log.Printf("Article ID: %s", postId)
//log.Printf("PAYLOAD: %s", payload)
var client *http.Client
if config.Conf.Proxy != "" {
proxyURL, err := url.Parse(config.Conf.Proxy)
if err != nil {
panic(err)
}
client = &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyURL(proxyURL),
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}
} else {
client = &http.Client{}
}
req, err := http.NewRequest(method, urlreq, payload)
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36")
client := &http.Client{}
req, err := http.NewRequest(method, url, payload)
if err != nil {
log.Printf("Error constructing request %v\n", err)
return nil, err