SphericalKat / medium.rip

An alternative frontend for medium.com
https://medium.rip
Apache License 2.0
40 stars 1 forks source link

Loading articles failed #11

Open unstablemaple opened 1 year ago

unstablemaple commented 1 year ago

I am running my own instance inside a docker image and articles don't load. I get the following error whenever I click an article link: INFO[0067] Error unmarshalling body from response invalid character '<' looking for beginning of value

I have to note that I am running an ARM system, so I had to modify the Dockerfile a little bit. Any idea how to fix this?

dave0003 commented 5 months ago

I did a manual build and install, and get the same error.

INFO[0014] Error unmarshalling body from response invalid character '<' looking for beginning of value

In the browser it says:

invalid character '<' looking for beginning of value

It looks like pkg/client/medium_client.go is producing the error, at the end (I added the "2 - ").

        mr, err := entities.UnmarshalMediumResponse(body)
        if err != nil {
                log.Printf("2 - Error unmarshalling body from response %v\n", err)
                return nil, err
        }

It appears it doesn't like the response it's getting back from the API request. When I look at the body:

        body, err := io.ReadAll(res.Body)
        log.Printf(string(body))

It is returning a body that includes these sorts of things:

<title>Just a moment...</title>
#challenge-success-text
#challenge-error-text
<span id="challenge-error-text">Enable JavaScript and cookies to continue</span>

Not the sort of thing an API should return. It looks like the request is being blocked, or put behind a captcha.

I'm not sure if it's the IP address of the server, or if there's something that can be configured to get it to work (like an API key).