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

get_recent_comments() results in KeyError: 'entry_data' #124

Open agostini335 opened 3 years ago

agostini335 commented 3 years ago

Describe the bug calling get_recent_comments from a scraped post results in keyerror: 'entry_data'

headers = {"user-agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36 Edg/87.0.664.57", "cookie": f"sessionid={SESSIONID};"}

path = "https://www.instagram.com/p/"+s['shortcode']+"/" p = Post(path) p.scrape(headers=headers) ->> error here print(p.get_recent_comments())

Expected behavior I expect the list of comments of a post

stefco commented 3 years ago

Did you use Selenium or a requests.Session? The json_dict is structured differently in those cases. I made a patch that fixes those cases, will submit in a second.

NishantPuri99 commented 2 years ago

Hi @stefco , Has this update been merged yet?

If not, could you tell me how to work around this issue? Thanks

stefco commented 2 years ago

@NishantPuri99 It is not merged yet, have not seen feedback on #125. Seems the repository owner is not maintaining this project. I fixed it in the latest version on my fork's master branch, if you want to pip install that instead of the official release. Last time I tested, this worked.

NishantPuri99 commented 2 years ago

Ah okay. Thank you so much I'll use that then.

takweb12 commented 2 years ago

hi how can we get all comments in a post ? this method just got first page not alll

vahidsabet commented 2 years ago

hi how can we get all comments in a post ? this method just got first page not alll

Same question