snscrape icon indicating copy to clipboard operation
snscrape copied to clipboard

Error when scrape reddit

Open yudeng2022 opened this issue 3 years ago • 5 comments

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

yudeng2022 avatar Oct 20 '22 16:10 yudeng2022

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

JustAnotherArchivist avatar Oct 20 '22 16:10 JustAnotherArchivist

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?

yudeng2022 avatar Oct 20 '22 18:10 yudeng2022

Full output please for both snscrape -n 10 -v reddit-search steroid and snscrape --version.

JustAnotherArchivist avatar Oct 20 '22 19:10 JustAnotherArchivist

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

yudeng2022 avatar Oct 26 '22 17:10 yudeng2022

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.

JustAnotherArchivist avatar Oct 27 '22 17:10 JustAnotherArchivist

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.

JustAnotherArchivist avatar Nov 03 '22 16:11 JustAnotherArchivist