Error when scrape reddit
Hi I am using the following code to search 'steroid' but get the error message:
ScraperException: 4 requests to https://api.pushshift.io/reddit/search/submission/?q=steroid&size=1000&sort=desc failed, giving up.
Any idea how to fix it?
scraper = snscrape.modules.reddit.RedditSearchScraper('steroid')
for i, item in enumerate(scraper.get_items()):
print(item.json())
if i >= 10:
break
No idea, works fine here, although Pushshift isn't particularly speedy right now. Try with the CLI in verbose mode; it might reveal more about the actual problem via logging or through the dump file: snscrape -n 10 -v reddit-search steroid
Thank you for your quick reply! I used snscrape -n 10 -v reddit-search steroid but it says invalid search name. Is it a version issue?
Full output please for both snscrape -n 10 -v reddit-search steroid and snscrape --version.
so I got 'snscrape' is not recognized as an internal or external command, operable program or batch file. even though the installation seems to be successful ...
Well, clearly something in your environment is wrong. But I'm afraid I can't help you with that since there are so many different ways how Python, pip, and snscrape could be installed and executed.
Closing this as it isn't reproducible or actionable. Given the broken installation, I'll bet this is caused by other issues in the environment, perhaps a broken network configuration.