JustAnotherArchivist / snscrape

A social networking service scraper in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

snscrape instagram module is not working

sagar2120 opened this issue · comments

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