ScavioScavio
Pricing
Tools
Sign InsGet Startedg
  1. Home
  2. Tutorials
  3. How to Build a Reddit Sentiment Tracker
Tutorial

How to Build a Reddit Sentiment Tracker

Learn how to track brand sentiment on Reddit by searching for mentions and analyzing discussion tone over time. 4 steps, with runnable Python and JavaScript.

Get Free API KeyAPI Docs

Reddit discussions provide unfiltered user sentiment about products, brands, and services. This tutorial builds a sentiment tracker that searches Reddit for brand mentions via Scavio's Reddit endpoint, extracts discussion themes, and tracks sentiment over time. Unlike Reddit's native API (which requires OAuth and has strict rate limits), Scavio's Reddit search returns structured results with a simple API call.

Prerequisites

  • Python 3.8+ installed
  • requests library installed
  • A Scavio API key from scavio.dev
  • Brand or product names to track

Walkthrough

Step 1: Search Reddit for brand mentions

Query Scavio's Reddit endpoint for mentions of your brand or product.

Python
import requests, os
H = {'Authorization': 'Bearer ' + os.environ['SCAVIO_API_KEY']}

def search_reddit(query: str) -> list:
    resp = requests.post('https://api.scavio.dev/api/v1/reddit/search', headers=H,
        json={'query': query}, timeout=10)
    return resp.json()["data"].get('organic', [])

Step 2: Extract sentiment signals

Analyze post titles and snippets for positive, negative, and neutral signals.

Python
POSITIVE = ['love', 'great', 'best', 'amazing', 'recommend', 'switched to', 'works well']
NEGATIVE = ['hate', 'worst', 'terrible', 'broken', 'avoid', 'switched from', 'stopped using']

def classify_sentiment(text: str) -> str:
    text_lower = text.lower()
    pos = sum(1 for w in POSITIVE if w in text_lower)
    neg = sum(1 for w in NEGATIVE if w in text_lower)
    if pos > neg: return 'positive'
    if neg > pos: return 'negative'
    return 'neutral'

def analyze_mentions(results: list) -> dict:
    sentiments = {'positive': [], 'negative': [], 'neutral': []}
    for r in results:
        text = f"{r.get('title', '')} {r.get('snippet', '')}"
        sentiment = classify_sentiment(text)
        sentiments[sentiment].append({'title': r.get('title', ''), 'url': r.get('link', '')})
    return sentiments

Step 3: Generate a sentiment summary

Calculate sentiment ratios and highlight notable discussions.

Python
def sentiment_summary(sentiments: dict) -> dict:
    total = sum(len(v) for v in sentiments.values())
    return {
        'total_mentions': total,
        'positive_pct': round(len(sentiments['positive']) / max(total, 1) * 100, 1),
        'negative_pct': round(len(sentiments['negative']) / max(total, 1) * 100, 1),
        'neutral_pct': round(len(sentiments['neutral']) / max(total, 1) * 100, 1),
        'top_positive': sentiments['positive'][:3],
        'top_negative': sentiments['negative'][:3],
    }

Step 4: Run and save daily reports

Execute the tracker daily and store results for trend analysis.

Python
import json, datetime

def daily_sentiment(brand: str):
    results = search_reddit(brand)
    sentiments = analyze_mentions(results)
    summary = sentiment_summary(sentiments)
    date = datetime.date.today().isoformat()
    report = {'date': date, 'brand': brand, **summary}
    with open(f'sentiment_{brand}_{date}.json', 'w') as f:
        json.dump(report, f, indent=2)
    print(f"{brand}: {report['positive_pct']}% positive, {report['negative_pct']}% negative ({report['total_mentions']} mentions)")
    return report

daily_sentiment('YourBrand')

Python Example

Python
import requests, os
H = {'Authorization': 'Bearer ' + os.environ['SCAVIO_API_KEY']}

def reddit_sentiment(brand):
    data = requests.post('https://api.scavio.dev/api/v1/reddit/search', headers=H,
        json={'query': brand}, timeout=10).json()["data"]
    results = data.get('organic', [])
    print(f'{brand}: {len(results)} Reddit mentions found')
    return results

JavaScript Example

JavaScript
async function redditSentiment(brand) {
  const data = await fetch('https://api.scavio.dev/api/v1/reddit/search', {
    method: 'POST', headers: {'Authorization': `Bearer ${process.env.SCAVIO_API_KEY}`, 'Content-Type': 'application/json'},
    body: JSON.stringify({query: brand})
  }).then(r => r.json()).then(p => p.data);
  return data.organic || [];
}

Expected Output

JSON
Daily Reddit sentiment reports with positive/negative/neutral breakdowns and notable discussion highlights.

Related Tutorials

    Frequently Asked Questions

    Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

    Python 3.8+ installed. requests library installed. A Scavio API key from scavio.dev. Brand or product names to track. A Scavio API key gives you 50 free credits on signup.

    Yes. The free tier includes 50 credits on signup, which is more than enough to complete this tutorial and prototype a working solution.

    Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

    Related Resources

    Best Of

    Best YouTube Sentiment Analysis Tools in 2026

    Read more
    Solution

    Reddit Data Without Direct API

    Read more
    Comparison

    Brand24 vs Scavio

    Read more
    Best Of

    Best API for Price Monitoring in 2026

    Read more
    Glossary

    TikTok UGC Tracking

    Read more
    Comparison

    Reddit API / Search API vs Social Listening Tools (Brandwatch, Mention, Sprout Social)

    Read more

    Start Building

    Learn how to track brand sentiment on Reddit by searching for mentions and analyzing discussion tone over time. 4 steps, with runnable Python and JavaScript.

    Get Free API KeyRead the Docs
    ScavioScavio

    One scraper API for every social, search, e-commerce and real estate platform. Built for AI agents.

    Product

    • Features
    • Pricing
    • Dashboard
    • Affiliates

    Developers

    • Documentation
    • API Reference
    • Quickstart
    • MCP Integration
    • Python SDK

    Alternatives

    • Tavily Alternative
    • SerpAPI Alternative
    • Firecrawl Alternative
    • Exa Alternative
    • Serper Alternative
    • Tavily vs Scavio
    • SerpAPI vs Scavio
    • All alternatives
    • Compare Scavio vs alternatives

    Search APIs

    • Google Search API
    • Amazon Product API
    • YouTube API
    • Reddit API
    • Walmart Product API
    • TikTok API
    • Instagram API

    Tools

    • All Tools

    © 2026 Scavio. All rights reserved.

    Featured on TAAFT
    Terms of ServicePrivacy Policy