Export Instagram Hashtag Posts to a Spreadsheet
Scrape all posts tagged with a specific hashtag on Instagram. Paste a fetch() from DevTools to extract post authors, captions, likes, comments, and media URLs with automatic pagination.
Tags
Key Takeaways
- Works with any hashtag - Scrape posts tagged with any hashtag you can search on Instagram
- Automatic pagination - Loops through all result pages using the SERP API's
next_max_idcursor - Rich post data - Author username, caption, like count, comment count, media type, and post URL
- Exports to Google Sheets - Saves each batch of posts to your spreadsheet as it scrapes
- Requires a browser session - You copy a fetch() request from DevTools to authenticate
What This Workflow Does
This workflow scrapes all posts tagged with a specific hashtag on Instagram and exports them to Google Sheets. You search for a hashtag in Instagram's explore page, copy the API request from DevTools, paste it into the manual trigger, and the workflow pages through all results extracting post and author data.
Use cases:
- Research trending content for a specific hashtag or niche
- Find active creators posting about a topic for outreach or partnerships
- Analyze engagement patterns across posts in a hashtag
- Monitor competitor or industry hashtags for content strategy
How It Works
| Step | What Happens |
|---|---|
| 1. Manual trigger | You paste a fetch() request copied from Instagram's hashtag search API |
| 2. Parse fetch | Code node extracts the URL, headers, hashtag name, and rank token |
| 3. Loop through pages | Fetches result pages using next_max_id pagination with an 8-second delay |
| 4. Extract post data | Pulls author info, caption, engagement metrics, media type, and post URL |
| 5. Save to Google Sheets | AI node writes each batch of posts to your spreadsheet |
Setup Instructions
- Click "Use template" on this page
- Go to instagram.com and log into your account
- Navigate to
instagram.com/explore/search/keyword/?q=%23YOUR_HASHTAG(replace YOUR_HASHTAG) - Open DevTools (F12), go to the Network tab
- Scroll down to load more posts
- Filter by
top_serpin the Network tab - Find the
fbsearch/web/top_serpGET request - Right-click the request, select Copy > Copy as fetch
- Paste the fetch() into the Manual Trigger node
- Connect your Google Sheets connector and update the sheet URL in the AI node
- Run the workflow
Customization
| What You Can Change | How |
|---|---|
| Target hashtag | Paste a different fetch() request from another hashtag search |
| Google Sheet | Update the spreadsheet URL in the AI node prompt |
| Page limit | Change the max page count in the loop node condition (default: 100) |
| Delay between pages | Adjust the wait node duration (default: 8s) to avoid rate limits |
FAQ
Q: How do I find the right request in DevTools?
A: After scrolling the hashtag search page, filter the Network tab by top_serp. You should see a GET request to fbsearch/web/top_serp — that's the one to copy.
Q: How many posts can I scrape? A: The workflow fetches posts in batches per page with a max of 100 pages. The exact number of posts per page varies but is typically 20-30.
Q: Does this work for any hashtag? A: Yes, as long as the hashtag has results and isn't blocked by Instagram.
Q: Why is the delay 8 seconds instead of 5? A: The hashtag search API is more sensitive to rate limiting than other endpoints. A longer delay helps avoid session blocks.
Q: What if I get errors partway through? A: Your Instagram session may have expired. Re-copy the fetch() request from DevTools and try again.
Q: Can I track multiple hashtags at once? A: Run the workflow separately for each hashtag. Each run needs its own fetch() request from the corresponding hashtag search page.
Want to showcase your own workflows?
Become a Needle workflow partner and turn your expertise into recurring revenue.
