JustAnotherArchivist / snscrape

A social networking service scraper in Python
GNU General Public License v3.0
4.31k stars 698 forks source link

snscrape instagram module is not working #1007

Closed sagar2120 closed 1 year ago

sagar2120 commented 1 year ago

Describe the bug

    jsonData = r.text.split('<script type="text/javascript">window._sharedData = ')[1].split(';</script>')[0] # May throw an IndexError if Instagram changes something again; we just let that bubble.
IndexError: list index out of range

this error is occuired while scrape hashtag using InstagramHashtagScraper in below code

import snscrape.modules.instagram as snsInt

scraper = snsInt.InstagramHashtagScraper('graphic')
posts = scraper.get_items()

for post in posts:
    print(post.likes)

can you or any other can guide me

How to reproduce

    jsonData = r.text.split('<script type="text/javascript">window._sharedData = ')[1].split(';</script>')[0] # May throw an IndexError if Instagram changes something again; we just let that bubble.
IndexError: list index out of range

this error is occuired while scrape hashtag using InstagramHashtagScraper in below code

import snscrape.modules.instagram as snsInt

scraper = snsInt.InstagramHashtagScraper('graphic')
posts = scraper.get_items()

for post in posts:
    print(post.likes)

can you or any other can guide me

Expected behaviour

    jsonData = r.text.split('<script type="text/javascript">window._sharedData = ')[1].split(';</script>')[0] # May throw an IndexError if Instagram changes something again; we just let that bubble.
IndexError: list index out of range

this error is occuired while scrape hashtag using InstagramHashtagScraper in below code

import snscrape.modules.instagram as snsInt

scraper = snsInt.InstagramHashtagScraper('graphic')
posts = scraper.get_items()

for post in posts:
    print(post.likes)

can you or any other can guide me

Screenshots and recordings

No response

Operating system

windows 10

Python version: output of python3 --version

3.10.5

snscrape version: output of snscrape --version

snscrape 0.7.0.20230622

Scraper

instagram(InstagramHashtagScraper)

How are you using snscrape?

Module (import snscrape.modules.something in Python code)

Backtrace

No response

Log output

No response

Dump of locals

No response

Additional context

No response

JustAnotherArchivist commented 1 year ago

520