Tutorial

How to Build Daily News Digest with Search API

Build an automated daily news digest pipeline. Search topics, deduplicate, score relevance, and format for email or Slack.

A daily news digest keeps your team informed without everyone searching separately. This pipeline searches your topics via API, deduplicates across sources, scores by relevance and recency, and outputs a formatted digest for email or Slack. Monitoring 10 topics costs $0.05/day.

Prerequisites

  • Python 3.8+
  • requests library
  • A Scavio API key from scavio.dev
  • List of topics to monitor

Walkthrough

Step 1: Search multiple topics for news

Query each topic and collect articles across sources.

Python
import os, requests, json
from datetime import datetime
from collections import Counter

API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}

TOPICS = [
    'AI agent frameworks',
    'search API market',
    'MCP protocol updates',
    'LLM cost optimization',
    'developer tools funding',
]

def search_topic(topic):
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': f'{topic} news 2026', 'country_code': 'us'}).json()
    return [{'title': r.get('title', ''), 'link': r.get('link', ''),
             'snippet': r.get('snippet', ''), 'source': r.get('displayed_link', ''),
             'topic': topic} for r in data.get('organic_results', [])[:5]]

all_articles = []
for topic in TOPICS:
    articles = search_topic(topic)
    all_articles.extend(articles)
    print(f'  {topic}: {len(articles)} articles')
print(f'\nTotal: {len(all_articles)} articles. Cost: ${len(TOPICS) * 0.005:.3f}')

Step 2: Deduplicate and score articles

Remove duplicate articles and score by relevance signals.

Python
def deduplicate(articles):
    seen_links = set()
    unique = []
    for a in articles:
        link = a.get('link', '')
        if link and link not in seen_links:
            seen_links.add(link)
            unique.append(a)
    print(f'Deduplication: {len(articles)} -> {len(unique)} unique articles')
    return unique

def score_article(article):
    score = 50  # base
    title = article.get('title', '').lower()
    snippet = article.get('snippet', '').lower()
    # Recency signals
    if '2026' in title or '2026' in snippet: score += 15
    if any(w in title for w in ['today', 'just', 'breaking', 'new']): score += 10
    # Quality signals
    source = article.get('source', '').lower()
    quality_sources = ['techcrunch', 'reuters', 'bloomberg', 'theverge', 'arstechnica', 'github']
    if any(s in source for s in quality_sources): score += 20
    # Relevance signals
    if any(w in title for w in ['launch', 'release', 'raise', 'acquire']): score += 10
    return min(score, 100)

unique = deduplicate(all_articles)
for a in unique:
    a['score'] = score_article(a)
unique.sort(key=lambda x: x['score'], reverse=True)
print(f'\nTop scored articles:')
for a in unique[:5]:
    print(f'  [{a["score"]:3}] {a["title"][:55]}')

Step 3: Format digest for delivery

Generate a formatted digest suitable for email or Slack.

Python
def format_digest(articles, max_per_topic=3):
    print(f'\n{"=" * 60}')
    print(f'  DAILY NEWS DIGEST - {datetime.now().strftime("%Y-%m-%d")}')
    print(f'  {len(articles)} articles across {len(set(a["topic"] for a in articles))} topics')
    print(f'{"=" * 60}')
    # Group by topic
    by_topic = {}
    for a in articles:
        t = a['topic']
        if t not in by_topic:
            by_topic[t] = []
        by_topic[t].append(a)
    for topic, items in by_topic.items():
        items.sort(key=lambda x: x.get('score', 0), reverse=True)
        print(f'\n  ## {topic}')
        for item in items[:max_per_topic]:
            print(f'  - {item["title"][:55]}')
            print(f'    {item["snippet"][:70]}')
            print(f'    Source: {item["source"]} | Score: {item.get("score", 0)}')
    # Slack format
    print(f'\n--- Slack Format ---')
    for a in articles[:5]:
        print(f'*{a["title"][:50]}*')
        print(f'>{a["snippet"][:70]}')
        print(f'<{a["link"]}|Read more>')
    print(f'\n  Digest cost: ${len(TOPICS) * 0.005:.3f}/day')
    print(f'  Monthly: ${len(TOPICS) * 0.005 * 30:.2f}/month')

format_digest(unique)

Python Example

Python
import os, requests
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

def news_digest(topics):
    for topic in topics:
        data = requests.post('https://api.scavio.dev/api/v1/search',
            headers=SH, json={'query': f'{topic} news 2026', 'country_code': 'us'}).json()
        articles = data.get('organic_results', [])[:3]
        print(f'\n{topic}:')
        for a in articles:
            print(f'  - {a.get("title", "")[:50]}')

news_digest(['AI agents', 'search API market'])
print(f'Cost: $0.010')

JavaScript Example

JavaScript
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
for (const topic of ['AI agents', 'search API market']) {
  const data = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: SH,
    body: JSON.stringify({ query: `${topic} news 2026`, country_code: 'us' })
  }).then(r => r.json());
  console.log(`${topic}: ${(data.organic_results || []).length} articles`);
}

Expected Output

JSON
  AI agent frameworks: 5 articles
  search API market: 5 articles
  MCP protocol updates: 5 articles
Total: 25 articles. Cost: $0.025

Deduplication: 25 -> 22 unique articles

============================================================
  DAILY NEWS DIGEST - 2026-05-20
  22 articles across 5 topics
============================================================

  ## AI agent frameworks
  - OpenAI Releases Agent SDK 2.0 with Multi-Tool Support
    OpenAI announced the second major version of their agent...
    Source: techcrunch.com | Score: 95

  Digest cost: $0.025/day
  Monthly: $0.75/month

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+. requests library. A Scavio API key from scavio.dev. List of topics to monitor. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, 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.

Start Building

Build an automated daily news digest pipeline. Search topics, deduplicate, score relevance, and format for email or Slack.