我不确定如何修复以下代码以克服速率限制。另外,我不确定为什么它会停在 10 个帖子,即使我将 max_count 设置为 100。
代码:
import instaloader
loader= instaloader.Instaloader(download_comments=True,
download_videos=True,
download_geotags=True,
save_metadata=True)
loader.download_hashtag('fashion', max_count=100, fast_update=False, profile_pic=False)
问题是:
(base) mona@mona:~/research/insta-scrape$ python instaloader_tester.py
Retrieving pictures with hashtag #fashion...
[ 1/100] #fashion/2020-11-30_03-20-10_UTC.jpg [@___eshika__rao @ieshu_rao …] comments json
[ 2/100] #fashion/2020-11-30_03-04-22_UTC.jpg [would you let me ride shotgun…] comments json
[ 3/100] #fashion/2020-11-30_03-02-28_UTC.jpg [✨I bite back ✨]
HTTP redirect from https://www.instagram.com/graphql/query to https://www.instagram.com/accounts/login/
JSON Query to graphql/query: 429 Too Many Requests: redirected to login [retrying; skip with ^C]
Requests within last 10/11/20/22/30/60 minutes grouped by type:
other: 1 1 1 1 1 1
2b0673e0dc4580674a88d426fe00ea90: 3 3 3 3 3 3
* 97b41c52301f77ce508f55e66d17620e: 4 4 4 4 4 4
Instagram responded with HTTP error "429 - Too Many Requests". Please
do not run multiple instances of Instaloader in parallel or within
short sequence. Also, do not use any Instagram App while Instaloader
is running.
The request will be retried in 655 seconds, at 23:04.
Instagram 允许未登录用户的有限数量的请求,并且在一些请求之后(取决于我几个月前上次测试时通常可以在 10-300 之间),之后它将阻止未登录的用户,并且对于已登录的用户将缓慢响应在用户中也。您可以使用代理并尝试绕过限制。