Scrape Instagram Comments: Extract Comments from Any Post
Instagram comments are a goldmine of insights. Customer feedback, sentiment, questions, complaints—it's all there.
But copying comments manually? That's not scalable. Here's how to scrape Instagram comments programmatically.
What Comment Data Can You Get?
| Field | Description |
|---|---|
| Text | The comment content |
| Username | Who wrote it |
| Timestamp | When it was posted |
| Likes | How many likes the comment got |
| Replies | Responses to the comment |
| User info | Commenter's profile data |
Why Scrape Instagram Comments?
Sentiment Analysis
Understand how people feel about a brand, product, or post. Are comments positive, negative, or neutral?
Customer Research
Find out what customers are asking, complaining about, or praising.
Influencer Vetting
Check comment quality. Real engagement or bot comments? Genuine questions or generic praise?
Content Ideas
See what questions people ask in comments—these are content ideas.
Competitive Intelligence
Monitor competitor posts. What are their customers saying?
How to Scrape Instagram Comments
Using an API
The easiest method. One request, all comments:
const response = await fetch(
'https://api.sociavault.com/v1/scrape/instagram/comments?url=https://instagram.com/p/ABC123&limit=100',
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const comments = await response.json();
Response:
{
"success": true,
"data": [
{
"id": "comment_123",
"text": "This is amazing! 🔥",
"username": "user123",
"timestamp": "2026-01-08T14:30:00Z",
"likes": 45,
"replies": [
{
"text": "Thanks so much! 🙏",
"username": "original_poster",
"timestamp": "2026-01-08T15:00:00Z"
}
]
}
],
"total_comments": 1247
}
Python Example
import requests
API_KEY = 'your_api_key'
def scrape_instagram_comments(post_url, limit=100):
response = requests.get(
'https://api.sociavault.com/v1/scrape/instagram/comments',
params={'url': post_url, 'limit': limit},
headers={'Authorization': f'Bearer {API_KEY}'}
)
return response.json()
# Get comments
comments = scrape_instagram_comments('https://instagram.com/p/ABC123', 200)
for comment in comments['data']:
print(f"@{comment['username']}: {comment['text']}")
Use Cases
1. Sentiment Analysis
Categorize comments as positive, negative, or neutral:
from textblob import TextBlob
def analyze_sentiment(comments):
results = {'positive': 0, 'negative': 0, 'neutral': 0}
for comment in comments:
blob = TextBlob(comment['text'])
if blob.sentiment.polarity > 0.1:
results['positive'] += 1
elif blob.sentiment.polarity < -0.1:
results['negative'] += 1
else:
results['neutral'] += 1
return results
# Usage
comments = scrape_instagram_comments('https://instagram.com/p/ABC123', 500)
sentiment = analyze_sentiment(comments['data'])
print(sentiment)
# {'positive': 320, 'negative': 45, 'neutral': 135}
2. Find Common Questions
Extract questions from comments for FAQ content:
function findQuestions(comments) {
return comments.filter(c =>
c.text.includes('?') ||
c.text.toLowerCase().startsWith('how') ||
c.text.toLowerCase().startsWith('what') ||
c.text.toLowerCase().startsWith('where') ||
c.text.toLowerCase().startsWith('when')
);
}
const comments = await scrapeComments('https://instagram.com/p/ABC123', 500);
const questions = findQuestions(comments.data);
console.log('Customer questions:');
questions.forEach(q => console.log(`- ${q.text}`));
3. Detect Bot/Fake Comments
Identify suspicious comment patterns:
function detectBotComments(comments) {
const suspicious = [];
const genericPhrases = ['nice', 'great post', 'love this', 'amazing', '🔥', '💯'];
for (const comment of comments) {
const text = comment.text.toLowerCase();
// Very short generic comments
const isGeneric = genericPhrases.some(phrase =>
text === phrase || text === phrase + '!'
);
// Only emojis
const onlyEmojis = /^[\u{1F600}-\u{1F6FF}\s]+$/u.test(comment.text);
// No profile info
const noProfile = !comment.user?.follower_count;
if (isGeneric || onlyEmojis) {
suspicious.push(comment);
}
}
return {
total: comments.length,
suspicious: suspicious.length,
suspiciousRate: ((suspicious.length / comments.length) * 100).toFixed(1) + '%'
};
}
4. Monitor Brand Mentions
Track what people say about your brand:
async function monitorBrandComments(brandKeywords, competitorPosts) {
const mentions = [];
for (const postUrl of competitorPosts) {
const comments = await scrapeComments(postUrl, 200);
for (const comment of comments.data) {
const text = comment.text.toLowerCase();
if (brandKeywords.some(kw => text.includes(kw.toLowerCase()))) {
mentions.push({
postUrl,
comment: comment.text,
username: comment.username,
timestamp: comment.timestamp
});
}
}
}
return mentions;
}
5. Export to Spreadsheet
function commentsToCSV(comments) {
const headers = ['username', 'text', 'likes', 'timestamp'];
const rows = comments.map(c => [
c.username,
`"${c.text.replace(/"/g, '""')}"`, // Escape quotes
c.likes,
c.timestamp
]);
return [headers.join(','), ...rows.map(r => r.join(','))].join('\n');
}
// Save to file
const csv = commentsToCSV(comments.data);
require('fs').writeFileSync('comments.csv', csv);
Tips for Better Results
- Get enough comments - For sentiment analysis, 200+ comments gives better accuracy
- Check replies too - Sometimes the best insights are in reply threads
- Filter spam - Remove obvious bot comments before analysis
- Track over time - Monitor comments on new posts to spot trends
Getting Started
- Sign up at sociavault.com
- Get 50 free credits
- Copy your API key
- Start scraping comments
Frequently Asked Questions
Can I scrape comments from any Instagram post?
Yes, any public post. Private accounts and their posts cannot be accessed.
How many comments can I get?
The API can retrieve all comments on a post. For viral posts with thousands of comments, you may want to set a limit.
Do I get replies to comments?
Yes, the API returns nested replies along with the parent comments.
Can I get the commenter's profile info?
Yes, basic profile information (username, follower count, verified status) is included.
Is this legal?
Yes, scraping publicly visible comments is legal. See our Instagram scraping legal guide.
Related guides:
Found this helpful?
Share it with others who might benefit
Ready to Try SociaVault?
Start extracting social media data with our powerful API. No credit card required.