40 Commits
Author SHA1 Message Date
mycodedoesnotcompile2 7025eb1b43 Merge 13b3abbcab into 0cd9fd70cb 2025-12-13 13:12:32 +00:00
mycodedoesnotcompile2 13b3abbcab Rename postcss.config.ts to postcss.config.cjs 2025-12-13 13:12:29 +00:00
mycodedoesnotcompile2 b5784f609e Update medium_client.go 2025-12-13 12:45:06 +00:00
mycodedoesnotcompile2 e549b25e3a Update api.go 2025-12-13 12:44:03 +00:00
mycodedoesnotcompile2 b387a6d8f8 Update api.go 2025-12-13 12:43:46 +00:00
mycodedoesnotcompile2 9a6d287607 Update id_converter.go 2025-12-13 12:42:34 +00:00
mycodedoesnotcompile2 8b00007fb5 Update medium_client.go 2025-12-13 12:41:04 +00:00
mycodedoesnotcompile2 348e4e2527 Update medium_client.go 2025-12-13 12:39:16 +00:00
mycodedoesnotcompile2 d055ff6c72 Update medium_client.go 2025-12-13 12:31:48 +00:00
mycodedoesnotcompile2 6c9ba437a8 Update medium_client.go 2025-12-13 12:29:45 +00:00
mycodedoesnotcompile2 e50177599e Update medium_client.go 2025-12-13 12:29:15 +00:00
mycodedoesnotcompile2 d416ebad0f Update medium_client.go 2025-12-13 12:28:35 +00:00
mycodedoesnotcompile2 93f30a5a9a Update medium_client.go 2025-12-13 12:26:57 +00:00
mycodedoesnotcompile2 2965aeb592 Update medium_client.go 2025-12-13 12:26:05 +00:00
mycodedoesnotcompile2 f3beb86ec1 Update medium_client.go 2025-12-13 12:22:43 +00:00
mycodedoesnotcompile2 6c0f2a15c9 Update id_converter.go 2025-12-13 12:21:36 +00:00
mycodedoesnotcompile2 9bb6d7e79e Update medium_client.go 2025-12-13 12:21:27 +00:00
mycodedoesnotcompile2 36e5fe60e7 Update id_converter.go 2025-12-13 12:20:37 +00:00
mycodedoesnotcompile2 fd56a322f3 Update medium_client.go 2025-12-13 12:19:52 +00:00
mycodedoesnotcompile2 94a0f174d6 Update api.go 2025-12-13 12:05:50 +00:00
mycodedoesnotcompile2 49c695a291 Update id_converter.go 2025-12-13 12:05:19 +00:00
mycodedoesnotcompile2 39a72c9197 Update id_converter.go 2025-12-13 12:04:55 +00:00
mycodedoesnotcompile2 7d6e0c0aa8 Update api.go 2025-12-13 12:00:48 +00:00
mycodedoesnotcompile2 3e95bb581e Update api.go 2025-12-13 11:56:33 +00:00
mycodedoesnotcompile2 500eca390f Update api.go 2025-12-13 11:55:48 +00:00
mycodedoesnotcompile2 21bea85895 Update api.go 2025-12-13 11:53:17 +00:00
mycodedoesnotcompile2 4ae0b3c242 Update api.go 2025-12-13 11:50:04 +00:00
mycodedoesnotcompile2 c59e028ccd Update api.go 2025-12-13 11:46:40 +00:00
mycodedoesnotcompile2 2d48af0882 Update api.go 2025-12-13 11:46:09 +00:00
mycodedoesnotcompile2 3c9cda56d4 Update api.go 2025-12-13 11:45:38 +00:00
mycodedoesnotcompile2 0a4e286b24 Update api.go 2025-12-13 11:44:49 +00:00
mycodedoesnotcompile2 07949db7d5 Update api.go 2025-12-13 11:33:12 +00:00
mycodedoesnotcompile2 f2b44c6050 Update api.go 2025-12-13 11:32:28 +00:00
mycodedoesnotcompile2 e0e8a19963 Update api.go 2025-12-13 11:24:20 +00:00
mycodedoesnotcompile2 8f75e96acf Update api.go 2025-12-13 11:23:37 +00:00
mycodedoesnotcompile2 29b5f5fdcd Update api.go 2025-12-13 11:22:53 +00:00
mycodedoesnotcompile2 56458d4fdb Update api.go 2025-12-13 11:20:47 +00:00
mycodedoesnotcompile2 86823cb2e6 Update api.go 2025-12-13 11:12:49 +00:00
mycodedoesnotcompile2 3b4c17e744 Update api.go 2025-12-13 11:07:30 +00:00
mycodedoesnotcompile2 9607e4fd17 Update config.go 2025-12-13 11:01:19 +00:00
4 changed files with 33 additions and 3 deletions

No files matched your search

+5
View File
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/http"
"sync"
"github.com/medium.rip/api/routes"
@@ -32,6 +33,10 @@ 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) {
File renamed without changes.
+1
View File
@@ -17,6 +17,7 @@ type Config struct {
S3Endpoint string `koanf:"S3_ENDPOINT"`
Env string `koanf:"ENV"`
SecretKey string `koanf:"SECRET_KEY"`
Proxy string `koanf:"PROXY"`
}
var Conf *Config
+27 -3
View File
@@ -6,6 +6,8 @@ import (
"net/http"
"os"
"strings"
"net/url"
"crypto/tls"
log "github.com/sirupsen/logrus"
@@ -30,13 +32,35 @@ func PostData(postId string) (*entities.MediumResponse, error) {
}
// http client to post data
url := "https://medium.com/_/graphql"
urlreq := "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))
client := &http.Client{}
req, err := http.NewRequest(method, url, payload)
//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")
if err != nil {
log.Printf("Error constructing request %v\n", err)
return nil, err