instascrape icon indicating copy to clipboard operation
instascrape copied to clipboard

get_recent_comments() results in KeyError: 'entry_data'

Open agostini335 opened this issue 4 years ago • 6 comments

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

agostini335 avatar Jun 14 '21 15:06 agostini335

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.

stefco avatar Jun 19 '21 06:06 stefco

Hi @stefco , Has this update been merged yet?

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

NishantPuri99 avatar Aug 07 '21 16:08 NishantPuri99

@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.

stefco avatar Aug 07 '21 22:08 stefco

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

NishantPuri99 avatar Aug 08 '21 05:08 NishantPuri99

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

takweb12 avatar Dec 25 '21 17:12 takweb12

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

Same question

vahidsabet avatar Mar 05 '22 14:03 vahidsabet