To extract and log hashtags from Instagram exports, you need to process the data exported from Instagram—typically in the form of a .json or .zip archive containing multiple .json files or text logs of posts, captions, comments, etc.
Here’s a clear step-by-step breakdown to extract and log hashtags using a Python script:
📦 1. Download Your Instagram Export
From Instagram:
-
Go to Settings > Privacy and Security > Data Download or Instagram’s Data Download page.
-
Request your data. Once downloaded, extract the
.zipfile. -
Locate the relevant files:
-
media.json -
comments.json -
posts.json -
Or
content.jsondepending on the archive
-
🧾 2. Python Script to Extract Hashtags
🧠 How It Works
-
Scans all
.jsonfiles in the folder. -
Searches for captions, texts, titles, or comments with hashtags.
-
Uses regular expressions to find hashtags like
#example. -
Deduplicates and logs the final list.
📝 Output Example
🔧 Optional Enhancements
-
Save to a
.txtor.csvfile -
Track hashtag frequency:
-
Export to Excel with
pandas
Let me know if you’d like an advanced version that supports UI or batch processing across multiple user archives.