Closed ZeynepP closed 1 year ago
Hello @ZeynepP, can you give me a command or at least a instagram post url that can reproduce the problem you are having so I can try to fix it? Also does it happen on every posts or on some specific ones?
Hi @Yomguithereal ,
I am testing with user name, getting posts and for each post I am tryting to get comments : posts = scraper.user_posts("justinpjtrudeau")
It happens for every post.
Thanks ZP
@ZeynepP I fail to reproduce. I can get comments from https://www.instagram.com/p/CwqyWqqJR4J for instance. What version of minet
are you using currently?
@Yomguithereal I am using from source code.
scraper = InstagramAPIScraper()
posts = scraper.user_posts("justinpjtrudeau")
for post in posts:
print(post)
comments = scraper.comments(post['url'])
for com in comments:
print(com)
break
I also tested with pip install minet but for comments I have "AttributeError: 'InstagramAPIScraper' object has no attribute 'comments'" error.
@ZeynepP I don't reproduce your issue. Your code works on my end using latest version of the code. What is this snippet printing on your end?
from minet.__version__ import __identifier__
print(__identifier__)
Also, are you logged in Instagram on your local Firefox browser? You don't give anything to the scraper constructor and it's also possible it cannot use a valid cookie to authenticate (it's not easy to detect programmatically authentication errors on Instagram they are a bit devious about this).
Latest version is 1.0.0-a51
but I guess your issue is authentication. The scraper constructor either takes the name of a local browser from which to extract your instagram connexion cookie (e.g. firefox
, chrome
etc.) or a string containing the cookie itself.
@Yomguithereal You are totally right, authentification problem. I logged into instagram it worked on my local.
@Yomguithereal One more question, when I run it on the server, i should give a string containing the cookie itself ?
Indeed. You can use the minet cookies firefox --url https://instagram.com
command locally to acquire it easily (or try scraper.cookie
).
Hi,
I am using instagram scraper, it works like a charm for posts (thanks) but i have problems while getting comments. What I found is that the line
post = getpath(data_post, ["items", 0, "pk"])
returns None because data_post has no items,post = data_post['graphql']["shortcode_media"]['id']
returns the correct id but still I am not able to get comments.Thanks in advance, ZP