medium.rip icon indicating copy to clipboard operation
medium.rip copied to clipboard

Loading articles failed

Open unstablemaple opened this issue 2 years ago • 1 comments

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?

unstablemaple avatar Sep 20 '23 13:09 unstablemaple

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).

dave0003 avatar Apr 20 '24 03:04 dave0003