chris-greening / instascrape

Powerful and flexible Instagram scraping library for Python, providing easy-to-use and expressive tools for accessing data programmatically
https://chris-greening.github.io/instascrape/
MIT License
636 stars 111 forks source link

instascrape.exceptions.exceptions.InstagramLoginRedirectError even though I used get_posts([...] login_first=True) #116

Open bogu399 opened 3 years ago

bogu399 commented 3 years ago

Describe the bug A clear and concise description of what the bug is. I used the tutorial code to scrape data from myself and putting straight in csv file, but I always got this error even though get_posts(login_first= True) The code is from the Joe Biden Tutorial and I just changed the JB's @ to myself. https://github.com/chris-greening/instascrape/blob/master/tutorial/examples/JoeBiden/joebiden.py

Traceback (most recent call last): File "scraper.py", line 18, in <module> scraped, unscraped = scrape_posts(posts, silent=False, headers=headers,pause=10) File "C:\Users\Paulo\AppData\Local\Programs\Python\Python37\lib\site-packages\instascrape\scrapers\scrape_tools.py", line 179, in scrape_posts post.scrape(session=session, webdriver=webdriver, headers=headers) File "C:\Users\Paulo\AppData\Local\Programs\Python\Python37\lib\site-packages\instascrape\scrapers\post.py", line 80, in scrape webdriver=webdriver File "C:\Users\Paulo\AppData\Local\Programs\Python\Python37\lib\site-packages\instascrape\core\_static_scraper.py", line 144, in scrape return_data = self._get_json_from_source(self.source, headers=headers, session=session) File "C:\Users\Paulo\AppData\Local\Programs\Python\Python37\lib\site-packages\instascrape\core\_static_scraper.py", line 265, in _get_json_from_source self._validate_scrape(json_dict) File "C:\Users\Paulo\AppData\Local\Programs\Python\Python37\lib\site-packages\instascrape\core\_static_scraper.py", line 301, in _validate_scrape raise InstagramLoginRedirectError instascrape.exceptions.exceptions.InstagramLoginRedirectError: Instagram is redirecting you to the login page instead of the page you are trying to scrape. This could be occuring because you made too many requests too quickly or are not logged into Instagram on your machine. Try passing a valid session ID to the scrape method as a cookie to bypass the login requirement

Desktop