Hello I trying out Instagram API using python and I am new to it. Hope you guys could take a look at it & help me out.
I am wondering how to collect the date & time from users that have commented for each media id.
I have tried using 'created_time' but it did not manage to collect anything. Any ideas how to troubleshoot it? Or is there something wrong with my code? I manage to print out username & their comments though.
Here is my code:
from instagram.client import InstagramAPI import re access_token = "XXX" client_secret = "XXX" api = InstagramAPI(access_token=access_token, client_secret=client_secret) recent_media, next_ = api.user_recent_media(user_id="476132155") while next_: more_media, next_ = api.user_recent_media(with_next_url=next_) recent_media.extend(more_media) for media in recent_media: try: comments = api.media_comments(media.id) for i in comments: print i.created_time except (UnicodeEncodeError): pass
AttributeError: 'Comment' object has no attribute 'created_time'