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
625 stars 109 forks source link

IndexError: list index out of range #119

Closed radoya closed 3 years ago

radoya commented 3 years ago

Hi there.

I am trying to get this script up on Debian / Python3.9 but this is what error I am geting from this simple example:

from instascrape import Profile 
profile = Profile('chris_greening')
profile.scrape()
/home/username/.local/lib/python3.9/site-packages/instascrape/core/_static_scraper.py:134: MissingCookiesWarning: Request header does not contain cookies! It's recommended you pass at least a valid sessionid otherwise Instagram will likely redirect you to their login page.
  warnings.warn(
Traceback (most recent call last):
  File "/home/username/web/phibrows.training/public_html/scrape/sample.py", line 3, in <module>
    profile.scrape()
  File "/home/username/.local/lib/python3.9/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 "/home/username/.local/lib/python3.9/site-packages/instascrape/core/_static_scraper.py", line 264, in _get_json_from_source
    json_dict = json_dict_arr[1]
IndexError: list index out of range

Any idea how to solve this? Thanks.

radoya commented 3 years ago

You should have valid Instagram session ID to be able to scrape content.