A Python tool to scrape Instagram reel captions, comments, and associated video content. Features include video download, OCR text extraction from video frames, and another script for speech-to-text conversion for audio analysis.
def fetch_reel_details(reel_url, username, session_file):
L = instaloader.Instaloader()
L.load_session_from_file(username, session_file)
shortcode = reel_url.split("/")[-2]
post = instaloader.Post.from_shortcode(L.context, shortcode)
caption = post.caption if post.caption else "No caption available."
comments_and_usernames = []
for comment in post.get_comments():
# debugging: Print attributes to ensure correct access
if hasattr(comment.owner, "username"): comments_and_usernames.append((comment.owner.username, comment.text))
else: comments_and_usernames.append(("Anonymous", comment.text))
return caption, comments_and_usernames
There are no datasets linked
There are no datasets linked