A Python scraper that extracts full-text articles from OpenNews Source using pagination and the newspaper4k library.
- Automatic pagination through all article listing pages
- Extracts article metadata: title, authors (as array), publication date
- Full article text extraction using newspaper4k
- Configurable page limits and request delays for politeness
- Exports to JSON format
This project uses uv for dependency management.
# Install dependencies
uv syncuv run python scraper.py# Scrape only the first 2 pages
uv run python scraper.py --max-pages 2
# Adjust delay between requests (default: 1 second)
uv run python scraper.py --delay 2.0
# Specify output file
uv run python scraper.py --output my_articles.jsonuv run python scraper.py --max-pages <number> --delay <seconds> --output <filename>Articles are saved as a JSON array with the following structure:
[
{
"url": "https://source.opennews.org/articles/article-slug/",
"title": "Article Title",
"authors": ["Author Name 1", "Author Name 2"],
"date": "2024-01-15",
"text": "Full article text..."
}
]