regosen/gallery_get

ERROR getting json data after several retries! Does the user exist?

Closed this issue · 11 comments

The user exists, but it is using the new style reddit /user/ profile page not the old one. The JSON should be the same so I am unsure what's breaking here.

Requesting JSON data from reddit...
ERROR getting json data after several retries! Does the user exist?
If so, try saving the contents of the following to <>.json and try again.
http://www.reddit.com/user/<>/submitted/.json?limit=1000
Done!

Hi, I just tried a few reddit usernames and can't reproduce this. According to what you pasted, the script used "<>" as the user name. How did you get the script to do that? I assume you didn't simply enter <> as the username.

Can you try with this username: 17reasons

Requesting JSON data from reddit...
ERROR getting json data after several retries! Does the user exist?
If so, try saving the contents of the following to 17reasons.json and try again.
http://www.reddit.com/user/17reasons/submitted/.json?limit=1000

Python 3.5.3 on 4.9.65-3+deb9u1

Thanks for the info! Odd, I'm able to collect pictures from that user (cool scenery). I tried with Python 3.6.1 as well as 2.7.10, both on OSX though.

Can you try this? Paste the URL from the error message into your browser:

http://www.reddit.com/user/17reasons/submitted/.json?limit=1000

You should see a bunch of JSON-formatted text that starts out like this:

{"kind": "Listing", "data": {"after": null, "dist": 37, "modhash": "7mj8u47vwjd39f1d68572b992ce7729ece1656a441c8137fec", "whitelist_status": "promo_all", "children": [{"kind": "t3", "data": {"domain": "i.redd.it", ...

What do you see?

I'm able to see the same JSON listing in the broswer and can download it via curl on my local machine.

I tried using curl on the remote and it's also failing. I'm going to see if it's the proxy settings on my remote later today and will update if I see anything odd. It had been working before. Possibly something broke and I am seeing it with this script 1st.

And it looks like gallery_get.py is working with my proxy set up but reddit_get.py isn't. I'm going to look into this more over the weekend.

Can you try one more thing for me? In reddit_get.py change this:

        if not "data" in reddit_json:
            print("ERROR getting json data after several retries!  Does the user exist?")

to this (added an extra line):

        if not "data" in reddit_json:
            print(reddit_json)
            print("ERROR getting json data after several retries!  Does the user exist?")

and post the new output.

I get this:

python3 ~/prog/gallery_get/reddit_get.py 17reasons
Requesting JSON data from reddit...
{}
ERROR getting json data after several retries!  Does the user exist?
If so, try saving the contents of the following to 17reasons.json and try again.
http://www.reddit.com/user/17reasons/submitted/.json?limit=1000
Done!

I'm 90% sure that the code isn't working with my proxy.

Oh interesting, that's not what I expected. I wonder if it's cached for you somehow. Can you try it from a different computer?

So it's working on my local machine and it's failing on my pi when the tor proxy is on and working when the tor proxy is off. I'm 90% sure this is just not working with the socks5 proxy.

I replaced this

USER_QUERY = "http://www.reddit.com/user/%s/submitted/.json?limit=1000"
with this

USER_QUERY = "https://www.reddit.com/user/%s/submitted/.json?limit=1000"

And it's now working.

Looks like this is an issue with my proxy set up failing to rewrite to https from http.

You can close this issue, but it wouldn't hurt to switch to https by default.

Ah! I've gone ahead and submitted an update to this repository. Thanks for helping to improve this project!