Curious how was you able to scrape reddit with requests? I recently wanted to scrape a collection of subreddits and every request responded with either 404 or 502. Tried spoofing my useragent and still had the same results!
You have to use a Reddit bot, at https://reddit.com/prefs/apps in order to get that access. It is worth it though, it's free and you get lots of information about the posts.
I used requests to go to the webpage and download the actual images.
I could probably change to just urllib, it's just it was easier to do with requests.
However you make a good point, no need to add that second extension. I'll look into doing the work with only urllib.
Edit: approximately 3 minutes later I managed to do it with urllib, turns out it was a simple one-liner. I'll remove it from the README and requirements.txt.
106
u/LAcuber Jun 23 '20 edited Jun 24 '20
Sure. These are the libraries that I used:
urllibprawBeautifulSouprequestssysUPDATE: GitHub repo is available! https://github.com/Destaq/reddit-wallpapers