Build automated news monitoring with date filtering, intent forcing, and domain restrictions.
This example builds a news monitoring system that searches for recent articles on specific topics, filters by date and source, and collects results for processing.
# Search for AI news from the past 24 hourscurl -s "https://search-api.andisearch.com/api/v1/search?q=artificial+intelligence&intent=news&dateRange=24h&limit=10" \ -H "x-api-key: $ANDI_API_KEY" | jq '.results[] | {title, link, date, source}'
Run searches on a schedule using cron or a task scheduler:
import timedef monitor_loop(topics: list[str], interval_seconds: int = 3600): """Check for new articles every interval.""" while True: for topic in topics: articles = search_news(topic, date_range="24h") if articles: print(f"[{datetime.now()}] {topic}: {len(articles)} new articles") # Process articles: send alerts, save to database, etc. time.sleep(interval_seconds)
When running scheduled searches, respect your rate limits. Space requests out and use the X-RateLimit-Remaining header to monitor usage.