Automated Realtime Global Observer System - Python Client & API for Middle East News
Project description
ARGOS โ Automated Realtime Global Observer System
A 3-layer automated news pipeline that continuously scrapes, enriches, and serves articles from 4 major Middle Eastern news networks โ via a REST API and Python client library.
Table of Contents
- Overview
- Architecture
- News Sources
- Quick Start
- Running Spiders
- API Reference
- Scheduling
- Data Model
- Configuration
- Project Structure
Overview
ARGOS (Argus Panoptes sees everything) automates the full lifecycle of news collection from the Middle East:
- ๐ท๏ธ Scrapes articles from 4 sources using Scrapy spiders
- ๐ง Enriches them with editorial metadata (orientation, trust score, influence flags)
- ๐๏ธ Stores everything locally in SQLite โ no cloud dependency
- ๐ Exposes a FastAPI REST API with filtering, pagination, and sorting
- ๐ฆ Ships a ready-to-use Python client library
Architecture
[ News Websites ]
โ HTTP scraping (Scrapy)
โผ
[ Home Server โ Scrapy Engine ] โ Continuous crawl with dedup & validation
โ Direct write
โผ
[ SQLite Database ] โ Local, unlimited storage
โ Query layer
โผ
[ FastAPI REST API ] โ Exposed via argos.news.ydns.eu
โ Python calls
โผ
[ ArgosClient Library ] โ Import and use in any Python project
Pipeline stages per article:
| Stage | Component | Priority |
|---|---|---|
| Field validation | pipelines/validation.py |
100 |
| URL deduplication | pipelines/dedup.py |
200 |
| SQLite storage | pipelines/storage.py |
800 |
News Sources
| Source | Country | Orientation | Trust Score | Israeli-Influenced |
|---|---|---|---|---|
| Al Jazeera | Qatar | Center-Left | 0.55 | No |
| Al Arabiya | Saudi Arabia | Right | 0.40 | Yes |
| Sky News Arabia | UAE | Center-Right | 0.48 | Yes |
| Middle East Eye | UK (ME Focus) | Left | 0.48 | No |
Trust scores and influence flags are defined in
scraper/argos/registry.pyand are attached to every article at scrape time.
Quick Start
Prerequisites
- Python 3.11+
pip- Linux or macOS (for the home server component)
1. Install
# Clone the repository
git clone <repo-url> && cd argos
# Create and activate a virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Configure environment (defaults work for local development)
cp .env.example .env
2. Launch
# Start the API server + all 4 spiders
python launch.py
# Or start components independently:
python launch.py --api-only # API server only
python launch.py --spiders-only # All spiders
python launch.py --spiders aljazeera middleeasteye # Specific spiders
3. Verify
| Resource | URL |
|---|---|
| Swagger UI | http://localhost:8000/docs |
| Health check | http://localhost:8000/v1/health |
| Latest articles | http://localhost:8000/v1/articles/latest |
| Sources | http://localhost:8000/v1/sources |
4. Use the Python Client
from client import ArgosClient
# Connect to the public instance
client = ArgosClient()
# Or connect to your local instance
# client = ArgosClient(base_url="http://localhost:8000")
# Fetch the 10 most recent articles
latest = client.get_latest(count=10)
for article in latest:
print(f"[{article['source_name']}] {article['title']}")
# Search with filters
results = client.get_articles(
source_name="Al Jazeera",
category="war",
date_from="2024-01-01",
page_size=50,
)
print(f"Found {results['pagination']['total_results']} articles")
# List all sources
for source in client.get_sources():
print(f"{source['source_name']} ({source['country']}) โ trust: {source['trust_score']}")
Running Spiders
source venv/bin/activate
# Run a single spider
scrapy crawl aljazeera
scrapy crawl alarabiya
scrapy crawl skynewsarabia
scrapy crawl middleeasteye
# Limit output for testing
scrapy crawl aljazeera -s CLOSESPIDER_ITEMCOUNT=10
# Resume an interrupted crawl
scrapy crawl aljazeera -s JOBDIR=./data/crawl_jobs/aljazeera
API Reference
Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET |
/v1/health |
System status |
GET |
/v1/sources |
List all news sources |
GET |
/v1/articles |
Search articles with filters and pagination |
GET |
/v1/articles/latest |
Fetch N most recent articles |
GET |
/v1/articles/{id} |
Fetch a single article by ID |
Full interactive documentation is available at /docs (Swagger UI) when the server is running.
Filter Parameters โ GET /v1/articles
| Parameter | Type | Description |
|---|---|---|
source_name |
string | Filter by network name |
country |
string | Filter by source country |
category |
string | politics, economy, tech, war, health, science, culture, sports, environment, other |
topic |
string | Alias for category |
orientation |
string | Editorial leaning |
is_israeli_influenced |
bool | Israeli influence flag |
date_from |
ISO 8601 | Earliest publication date |
date_to |
ISO 8601 | Latest publication date |
title |
string | Partial title match |
tags |
string | Comma-separated tags (AND logic) |
page |
int | Page number (default: 1) |
page_size |
int | Results per page (default: 20, max: 100) |
sort_by |
string | Column to sort by (default: published_at) |
order |
string | asc or desc (default: desc) |
Scheduling
ARGOS is designed for continuous, unattended operation. The recommended setup uses cron for spiders and systemd or screen for the API.
# Edit crontab to scrape every hour
crontab -e
0 * * * * cd /path/to/argos && /path/to/venv/bin/python launch.py --spiders-only
# Keep the API alive with screen
screen -dmS argos-api python launch.py --api-only
# Or create a systemd service for production
# โ /etc/systemd/system/argos-api.service
Data Model
Every article is stored with exactly 13 fields:
| Field | Type | Origin |
|---|---|---|
title |
string |
Scraped from article HTML |
content |
string |
Scraped from article HTML |
summary |
string |
Meta tags or first paragraph |
category |
enum |
Spider classification |
tags |
list[str] |
Article metadata |
source_name |
string |
registry.py |
source_url |
string |
Spider URL |
published_at |
ISO 8601 | Article HTML |
scraped_at |
ISO 8601 | Auto-generated at crawl time |
country |
string |
registry.py |
orientation |
enum |
registry.py |
trust_score |
float [0โ1] |
registry.py |
is_israeli_influenced |
bool |
registry.py |
Configuration
Copy .env.example to .env and adjust as needed. Defaults work out of the box for local development.
| Variable | Default | Description |
|---|---|---|
DATABASE_PATH |
./data/argos.db |
SQLite database path |
API_HOST |
0.0.0.0 |
API bind address |
API_PORT |
8000 |
API port |
API_BASE_URL |
http://argos.news.ydns.eu:8000 |
Public API base URL |
PROXY_URL |
(empty) | Optional HTTP proxy for geo-blocked sources |
LOG_LEVEL |
INFO |
Logging verbosity (DEBUG, INFO, WARNING, ERROR) |
JOBDIR |
./data/crawl_jobs |
Scrapy job persistence directory |
Project Structure
argos/
โโโ launch.py โ Entry point โ start API and/or spiders
โโโ requirements.txt
โโโ .env.example
โโโ scrapy.cfg
โ
โโโ scraper/argos/ โ Scrapy engine
โ โโโ items.py โ ArticleItem (13 fields)
โ โโโ registry.py โ Source metadata + apply_registry()
โ โโโ settings.py โ Scrapy settings (documented)
โ โโโ middlewares.py โ User-agent rotation + proxy support
โ โโโ pipelines/
โ โ โโโ validation.py โ Field validation (priority 100)
โ โ โโโ dedup.py โ URL deduplication (priority 200)
โ โ โโโ storage.py โ SQLite write (priority 800)
โ โโโ spiders/
โ โโโ aljazeera.py
โ โโโ alarabiya.py
โ โโโ skynewsarabia.py
โ โโโ middleeasteye.py
โ
โโโ api/ โ FastAPI REST layer
โ โโโ main.py โ App entry point
โ โโโ config.py โ Environment settings
โ โโโ database.py โ SQLite query layer
โ โโโ models.py โ Pydantic response models
โ โโโ openapi.yaml โ OpenAPI 3.1 spec
โ โโโ routes/
โ โโโ articles.py โ /v1/articles
โ โโโ sources.py โ /v1/sources
โ โโโ health.py โ /v1/health
โ
โโโ client/ โ Python client library
โโโ argos_client.py โ ArgosClient class
โโโ exceptions.py โ ArgosAPIError
Developer
Zayani Mouhamed Mouheb / EGen Labs โ ARGOS v0.3.x
Argus Panoptes sees everything.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file argos_news-0.3.3.tar.gz.
File metadata
- Download URL: argos_news-0.3.3.tar.gz
- Upload date:
- Size: 99.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff579678a57c66674cb91c0419ce7c1848e48c74df6d6a405a765e2dc4e85259
|
|
| MD5 |
46e25283c712e4945cfa9a77bd39b060
|
|
| BLAKE2b-256 |
34f91e6dba101e1a7c283c4ef7b0cbde9ee758f3ee244f5fc2e229e7548cfe01
|
File details
Details for the file argos_news-0.3.3-py3-none-any.whl.
File metadata
- Download URL: argos_news-0.3.3-py3-none-any.whl
- Upload date:
- Size: 99.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a3eaec0085172640424576eb14f675293c7f7015a8c607ef350e72f56d45c25
|
|
| MD5 |
44f54b899a5e326f8472ef9c7593340d
|
|
| BLAKE2b-256 |
ddfd62713bc1f6068fb242c5c044f7f83becb3b5681820fc9c5dc71d28a74e28
|