wwyaiykycnf / e621dl

The automated e621.net downloader
40 stars 23 forks source link

Unable to decode json #36

Closed DatDraggy closed 7 years ago

DatDraggy commented 7 years ago

So I wanted to use this again to get an artists gallery but now the json can't be decoded.

e621dl      INFO     running e621dl version 2.4.6
e621dl      INFO     e621dl was last run on 2017-02-23

Traceback (most recent call last):
  File "K:\Downloads\e621dl-master\e621dl-master\test\e621dl.py", line 93, in <module>
    current_page, default.MAX_RESULTS)
  File "K:\Downloads\e621dl-master\e621dl-master\test\lib\e621_api.py", line 26, in get_posts
    results = loads(SPOOF.open(request).read().decode())
  File "C:\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

I tried multiple tags but always the same.

Did e621 change their json objects?

DatDraggy commented 7 years ago

Aight... Could be because of rate limiting. Investigated a bit and asked one of the devs.

Also, you should use the user agent from the API guidelines :P https://github.com/wwyaiykycnf/e621dl/blob/master/lib/downloader.py#L11

Here the guidelines. Should be "e621dl v2.4.6 (by [username])" to prevent getting blocked. https://e621.net/help/show/api

DatDraggy commented 7 years ago

Update: It is because of rate limiting for some reason. Copied json from a tag to my own webserver and changed the url in e621_api.py to my domain. Worked fine.

I'll leave this open for the user agent thingy. Don't know what you want to do with that. It's required to use the "myproject/version (by username)" thing

Wulfre commented 7 years ago

I replaced the user agent on my own fork and it works fine now. The imitation was blacklisted by e621.

DatDraggy commented 7 years ago

Ah cool. It still doesn't work for me. Dang.

Wulfre commented 7 years ago

What doesn't work, my fork? Or did you try to modify the user agent from the main branch? From what I recall, the main branch had the user agent hard-coded in 2 different places.

DatDraggy commented 7 years ago

lmao I didn't even see that... Okay yea I changed the second file with the user agent in it as well now. Thanks