Python Forum
Problem installing instaloader
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem installing instaloader
#11
@snippsat
I used the code you sent me and it worked, but as soon as I changed the hashtag or datetime, it stopped working. Let's say I want all posts between 1 Jan. 2007 and 31. Dec. 2017 with the hashtag "bookerprize":

from datetime import datetime
from itertools import dropwhile, takewhile
 
import instaloader
 
L = instaloader.Instaloader()
 
posts = L.get_hashtag_posts('bookerprize')
# or
# posts = instaloader.Profile.from_username(L.context, PROFILE).get_posts()
 
SINCE = datetime(2007, 1, 1)
UNTIL = datetime(2017, 12, 31)
 
for post in takewhile(lambda p: p.date > UNTIL, dropwhile(lambda p: p.date > SINCE, posts)):
    print(post.date)
    L.download_post(post, '#bookerprize')
but it doesn't do anything. It takes an eternity for the "In [*]:" to change to "In [2]:" and when it does I get the following error:

Error:
JSON Query to explore/tags/bookerprize/: 429 Too Many Requests [retrying; skip with ^C] JSON Query to explore/tags/bookerprize/: 429 Too Many Requests [retrying; skip with ^C] JSON Query to explore/tags/bookerprize/: HTTP error code 502. [retrying; skip with ^C] --------------------------------------------------------------------------- TooManyRequestsException Traceback (most recent call last) ~\Anaconda\lib\site-packages\instaloader\instaloadercontext.py in get_json(self, path, params, host, session, _attempt) 373 if resp.status_code == 429: --> 374 raise TooManyRequestsException("429 Too Many Requests") 375 if resp.status_code != 200: TooManyRequestsException: 429 Too Many Requests During handling of the above exception, another exception occurred: TooManyRequestsException Traceback (most recent call last) ~\Anaconda\lib\site-packages\instaloader\instaloadercontext.py in get_json(self, path, params, host, session, _attempt) 373 if resp.status_code == 429: --> 374 raise TooManyRequestsException("429 Too Many Requests") 375 if resp.status_code != 200: TooManyRequestsException: 429 Too Many Requests During handling of the above exception, another exception occurred: TooManyRequestsException Traceback (most recent call last) ~\Anaconda\lib\site-packages\instaloader\instaloadercontext.py in get_json(self, path, params, host, session, _attempt) 373 if resp.status_code == 429: --> 374 raise TooManyRequestsException("429 Too Many Requests") 375 if resp.status_code != 200: TooManyRequestsException: 429 Too Many Requests The above exception was the direct cause of the following exception: ConnectionException Traceback (most recent call last) <ipython-input-11-afa213953ceb> in <module> 13 UNTIL = datetime(2008, 12, 31) 14 ---> 15 for post in takewhile(lambda p: p.date > UNTIL, dropwhile(lambda p: p.date > SINCE, posts)): 16 print(post.date) 17 L.download_post(post, '#bookerprize') ~\Anaconda\lib\site-packages\instaloader\instaloader.py in get_hashtag_posts(self, hashtag) 831 params = {'__a': 1} 832 hashtag_data = self.context.get_json('explore/tags/{0}/'.format(hashtag), --> 833 params)['graphql']['hashtag']['edge_hashtag_to_media'] 834 yield from (Post(self.context, edge['node']) for edge in hashtag_data['edges']) 835 has_next_page = hashtag_data['page_info']['has_next_page'] ~\Anaconda\lib\site-packages\instaloader\instaloadercontext.py in get_json(self, path, params, host, session, _attempt) 411 if is_iphone_query and isinstance(err, TooManyRequestsException): 412 self._ratecontrol_graphql_query('iphone', untracked_queries=True) --> 413 return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1) 414 except KeyboardInterrupt: 415 self.error("[skipped by user]", repeat_at_end=False) ~\Anaconda\lib\site-packages\instaloader\instaloadercontext.py in get_json(self, path, params, host, session, _attempt) 411 if is_iphone_query and isinstance(err, TooManyRequestsException): 412 self._ratecontrol_graphql_query('iphone', untracked_queries=True) --> 413 return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1) 414 except KeyboardInterrupt: 415 self.error("[skipped by user]", repeat_at_end=False) ~\Anaconda\lib\site-packages\instaloader\instaloadercontext.py in get_json(self, path, params, host, session, _attempt) 404 error_string = "JSON Query to {}: {}".format(path, err) 405 if _attempt == self.max_connection_attempts: --> 406 raise ConnectionException(error_string) from err 407 self.error(error_string + " [retrying; skip with ^C]", repeat_at_end=False) 408 try: ConnectionException: JSON Query to explore/tags/bookerprize/: 429 Too Many Requests
and I get no actual output. I have never had this problem with the command line version, but to be sure I used a different hashtag of which I know there are a lot less posts, but either I got the same error message, or I simply didn't get anything at all - no output, no error message. I tried to read their "troubleshooting" essay, but I don't understand it - I think my English may not be good enough when it comes to the specific terminology used. Would you please help and explain it to me? How can I solve this problem?
Reply


Messages In This Thread
Problem installing instaloader - by ledgreve - Oct-27-2019, 12:29 PM
RE: Problem installing instaloader - by Larz60+ - Oct-27-2019, 02:17 PM
RE: Problem installing instaloader - by ledgreve - Oct-28-2019, 08:22 AM
RE: Problem installing instaloader - by Larz60+ - Oct-28-2019, 11:01 AM
RE: Problem installing instaloader - by ledgreve - Oct-29-2019, 08:28 AM
RE: Problem installing instaloader - by Larz60+ - Oct-29-2019, 08:41 AM
RE: Problem installing instaloader - by ledgreve - Oct-29-2019, 09:20 AM
RE: Problem installing instaloader - by snippsat - Oct-29-2019, 12:39 PM
RE: Problem installing instaloader - by ledgreve - Nov-04-2019, 08:53 AM
RE: Problem installing instaloader - by snippsat - Nov-04-2019, 05:04 PM
RE: Problem installing instaloader - by ledgreve - Nov-05-2019, 09:14 AM
RE: Problem installing instaloader - by buran - Nov-05-2019, 09:23 AM
RE: Problem installing instaloader - by ledgreve - Nov-05-2019, 09:47 AM
RE: Problem installing instaloader - by buran - Nov-05-2019, 10:08 AM
RE: Problem installing instaloader - by ledgreve - Nov-05-2019, 10:27 AM
RE: Problem installing instaloader - by baquerik - Nov-05-2019, 10:35 AM
RE: Problem installing instaloader - by ledgreve - Nov-05-2019, 10:38 AM
RE: Problem installing instaloader - by baquerik - Nov-05-2019, 11:03 AM
RE: Problem installing instaloader - by buran - Nov-05-2019, 11:17 AM
RE: Problem installing instaloader - by buran - Nov-05-2019, 11:25 AM
RE: Problem installing instaloader - by snippsat - Nov-05-2019, 01:25 PM
RE: Problem installing instaloader - by ledgreve - Nov-18-2019, 11:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Photo Problem installing turtle MasterJediKnight7 17 25,007 Mar-18-2024, 10:22 AM
Last Post: bmohamadyar313
  [WORKED AROUND] Problem installing elitech-datareader, 'cannot import build_py_2to3' NeilUK 4 1,834 Jul-09-2023, 10:01 AM
Last Post: NeilUK
  Problem Installing rasterio gw1500se 1 2,246 Mar-24-2020, 06:28 PM
Last Post: gw1500se
  Problem installing library thunderspeed 2 2,377 Mar-22-2020, 11:04 PM
Last Post: thunderspeed
  Please help: problem installing/importing langdetect module in Jupyter Notebook ledgreve 3 7,398 Dec-30-2019, 08:17 AM
Last Post: LeanbridgeTech
  Problem with installing PyPDF2 Pavel_47 2 6,108 Nov-10-2019, 02:58 PM
Last Post: Pavel_47
  Problem installing numpy and matplotlib achondrite 1 3,181 Jan-16-2019, 11:43 PM
Last Post: snippsat
  Big problem for installing PyCharm sylas 2 3,976 Nov-12-2017, 05:17 PM
Last Post: sylas
  Problem installing urlparse4 package BobLoblaw 2 5,806 Oct-06-2017, 05:16 PM
Last Post: BobLoblaw

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020