mirror of
https://github.com/SphericalKat/medium.rip.git
synced 2025-12-18 07:25:58 +00:00
Update medium_client.go
This commit is contained in:
parent
6c9ba437a8
commit
d055ff6c72
@ -37,14 +37,15 @@ func PostData(postId string) (*entities.MediumResponse, error) {
|
|||||||
|
|
||||||
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))
|
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))
|
||||||
|
|
||||||
|
|
||||||
|
var client *http.Client
|
||||||
|
|
||||||
if config.Conf.Proxy != "" {
|
if config.Conf.Proxy != "" {
|
||||||
proxyURL, err := url.Parse(config.Conf.Proxy)
|
proxyURL, err := url.Parse(config.Conf.Proxy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
client := &http.Client{
|
client = &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
Proxy: http.ProxyURL(proxyURL),
|
Proxy: http.ProxyURL(proxyURL),
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
@ -54,7 +55,7 @@ func PostData(postId string) (*entities.MediumResponse, error) {
|
|||||||
}
|
}
|
||||||
log.Printf("Using proxy: %s", config.Conf.Proxy)
|
log.Printf("Using proxy: %s", config.Conf.Proxy)
|
||||||
} else {
|
} else {
|
||||||
client := &http.Client{}
|
client = &http.Client{}
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest(method, urlreq, payload)
|
req, err := http.NewRequest(method, urlreq, payload)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user