Closed kostyakoz closed 1 year ago
I've got the same error.
2022-07-31 09:09:51,533 INFO [4606178816] <instagrapi_crawler.py, InstagrapiPageCrawler, next_page, 0066>: crystalward2228, try to fetch the next page with (6110781932, None)
^@2022-07-31 09:10:01,812 ERROR [4606178816] <media.py, instagrapi, my_user_medias_paginated_v1, 0148>: Exceeded 30 redirects.
Traceback (most recent call last):
File "/Users/shangyang/.local/share/virtualenvs/instacrawl-rjFv3BNe/lib/python3.8/site-packages/instacrawl/crawlerprovider/providers/instagrapi_override/media.py", line 137, in my_user_medias_paginated_v1
items = self.private_request(
File "/Users/shangyang/.local/share/virtualenvs/instacrawl-rjFv3BNe/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 447, in private_request
raise e
File "/Users/shangyang/.local/share/virtualenvs/instacrawl-rjFv3BNe/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 434, in private_request
self._send_private_request(endpoint, **kwargs)
File "/Users/shangyang/.local/share/virtualenvs/instacrawl-rjFv3BNe/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 289, in _send_private_request
response = self.private.get(api_url, params=params)
File "/Users/shangyang/.local/share/virtualenvs/instacrawl-rjFv3BNe/lib/python3.8/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/Users/shangyang/.local/share/virtualenvs/instacrawl-rjFv3BNe/lib/python3.8/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/Users/shangyang/.local/share/virtualenvs/instacrawl-rjFv3BNe/lib/python3.8/site-packages/requests/sessions.py", line 723, in send
history = [resp for resp in gen]
File "/Users/shangyang/.local/share/virtualenvs/instacrawl-rjFv3BNe/lib/python3.8/site-packages/requests/sessions.py", line 723, in <listcomp>
history = [resp for resp in gen]
File "/Users/shangyang/.local/share/virtualenvs/instacrawl-rjFv3BNe/lib/python3.8/site-packages/requests/sessions.py", line 191, in resolve_redirects
raise TooManyRedirects(
requests.exceptions.TooManyRedirects: Exceeded 30 redirects.
@kostyakoz I cannot reproduce
but you can try using _v1:
data = cl.user_medias_v1(cl.user_id, 1)
@adw0rd same results with _v1
:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/instagrapi/mixins/media.py", line 554, in user_medias_paginated_v1
items = self.private_request(
File "/usr/local/lib/python3.8/dist-packages/instagrapi/mixins/private.py", line 447, in private_request
raise e
File "/usr/local/lib/python3.8/dist-packages/instagrapi/mixins/private.py", line 434, in private_request
self._send_private_request(endpoint, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/instagrapi/mixins/private.py", line 289, in _send_private_request
response = self.private.get(api_url, params=params)
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 677, in send
history = [resp for resp in gen]
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 677, in <listcomp>
history = [resp for resp in gen]
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 166, in resolve_redirects
raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp)
requests.exceptions.TooManyRedirects: Exceeded 30 redirects.
It happens after multiple calls of the method. I wonder what reason cause it, API limits maybe?
@kostyakoz maybe yes, can you try another account/proxy for test?
@adw0rd changing proxy for cached account keep this problem; fresh accounts work for some time (few hours), also I'm using sleep
for at least one minute between calls. As I understand when limits reached API should rise respective error?
By the way are limits available somewhere? As I read, 150 calls per acc/day. In my situation no more than 90 calls per acc/day made, all accounts SMS verified.
@kostyakoz my accounts process up to ~1000 requests per day, but I have different types of requests
IDK the actual instagram limits, i think it's the values floating
@adw0rd I'm also make cl.user_stories(page_id)
requests, but less often. I've checked it now, and these requests don't give this error (with same accounts & proxies), only with cl.user_medias(page_id, 10)
For some reason when this error raise it even can't be handled with except requests.exceptions.TooManyRedirects:
. How it can be handled?
try: cl.user_medias_v1(page_id, 10)
except requests.exceptions.TooManyRedirects:
Exceeded 30 redirects.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/instagrapi/mixins/media.py", line 554, in user_medias_paginated_v1
items = self.private_request(
File "/usr/local/lib/python3.8/dist-packages/instagrapi/mixins/private.py", line 447, in private_request
raise e
File "/usr/local/lib/python3.8/dist-packages/instagrapi/mixins/private.py", line 434, in private_request
self._send_private_request(endpoint, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/instagrapi/mixins/private.py", line 289, in _send_private_request
response = self.private.get(api_url, params=params)
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 677, in send
history = [resp for resp in gen]
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 677, in <listcomp>
history = [resp for resp in gen]
File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 166, in resolve_redirects
raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp)
requests.exceptions.TooManyRedirects: Exceeded 30 redirects.
I had the same error for the last 2-3 days by now. No "job" finished successfully. I now had time to take a look at it and tried a frehs login (same account, same settings, same proxy - just a fresh login).
After entering the 6-digit 2FA code the script started running again and seems to be working.
Maybe doing a fresh login helps others, too?
@adw0rd Very nice work by the way.
Hi, Can you recommend a tutorial on how to implement the challenge function? I'm not using 2 factor auth so I hope it'll be easier to use that challenge function.
Describe the bug Getting this error after multiple times of using
cl.user_medias(page_id, 15)
function. I'm tried with different proxies.To Reproduce
Traceback
Expected behavior Getting user medias.
Desktop (please complete the following information):
Additional context I wonder why this error happens. Too many requests? Block by proxy/IP? Or problems with account (temp ban)?