Skip to content

thegauravgiri/newsapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,099 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nepali News API πŸ‡³πŸ‡΅

Free and Open Source API for Nepali News Sources - Scrape, aggregate, and access Nepali news articles in JSON format with automatic updates every 4 hours.

License: MIT Python 3.11+ Automated Updates

πŸ“° About

Nepali News API is a free, open-source news aggregation service that scrapes top Nepali news sources and provides clean, structured JSON data. Perfect for developers building news apps, researchers analyzing Nepali media, or anyone needing programmatic access to Nepali news content.

Why This API?

  • πŸ†“ 100% Free - No API keys, no rate limits, no subscriptions
  • πŸ”„ Auto-Updated - Fresh news every 4 hours via GitHub Actions
  • 🌐 Open Source - Transparent, extensible, and community-driven
  • πŸ“± Easy Integration - Simple JSON endpoints for quick implementation
  • πŸ‡³πŸ‡΅ Unicode Support - Proper Nepali text encoding (UTF-8)
  • πŸ”Œ Plug & Play - No backend setup required for API consumers

πŸš€ Quick Start

Get Today's News (No Installation)

Access the API directly - no authentication required:

# Get today's aggregated news
curl https://raw.githubusercontent.com/gaurovgiri/newsapi/refs/heads/master/data/today.json

# Get news from a specific date (format: YYYY-MM-DD)
curl https://raw.githubusercontent.com/gaurovgiri/newsapi/refs/heads/master/data/2024-12-12.json

JavaScript:

fetch('https://raw.githubusercontent.com/gaurovgiri/newsapi/refs/heads/master/data/today.json')
  .then(res => res.json())
  .then(data => console.log(`${data.total_articles} articles from ${data.sources.length} sources`));

Python:

import requests
data = requests.get('https://raw.githubusercontent.com/gaurovgiri/newsapi/refs/heads/master/data/today.json').json()
print(f"{data['total_articles']} articles available")

➑️ See Quick Start Guide for more examples

Run Locally (For Contributors)

git clone https://github.com/gaurovgiri/newsapi.git
cd newsapi
pip install -r requirements.txt
python main.py

πŸ“Š API Response Format

{
  "scrape_date": "2024-12-12",
  "scrape_time": "06:00:15",
  "total_articles": 156,
  "sources": ["News24", "Kathmandu Post", "Ekantipur", "Nagarik News"],
  "articles": [
    {
      "title": "Article Title in Nepali or English",
      "link": "https://example.com/article",
      "description": "Article summary or excerpt",
      "published_date": "2024-12-12T10:30:00",
      "source": "News24",
      "language": "ne"
    }
  ]
}

➑️ See API Usage Guide for detailed documentation and examples

πŸ“° Supported News Sources

Source Language Website
News24 Nepali news24nepal.tv
Kathmandu Post English kathmandupost.com
Ekantipur Nepali ekantipur.com
Nagarik News Nepali nagariknews.nagariknetwork.com

Want to add more sources? See Contributing Guide

πŸ—οΈ Project Structure

newsapi/
β”œβ”€β”€ main.py                 # Main scraper orchestrator
β”œβ”€β”€ news_source.py          # Abstract base class for scrapers
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ run_scraper.sh          # Shell script for automation
β”œβ”€β”€ sources/                # Modular news source scrapers
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ _template.py       # Template for new sources
β”‚   β”œβ”€β”€ news24.py
β”‚   β”œβ”€β”€ kathmandu_post.py
β”‚   β”œβ”€β”€ ekantipur.py
β”‚   └── nagarik_news.py
β”œβ”€β”€ data/                   # Generated JSON files
β”‚   β”œβ”€β”€ today.json         # Latest scrape (always current)
β”‚   └── YYYY-MM-DD.json    # Historical date-stamped files
└── .github/
    └── workflows/
        └── scrape-news.yml # Automated scraping workflow

πŸ”§ Features

βœ… Modular Architecture - Each news source in a separate, maintainable module
βœ… Template-Based - Easy-to-use template for adding new sources
βœ… Date-Stamped Archives - Historical data preserved with date-based filenames
βœ… Automated Updates - GitHub Actions runs scraper every 4 hours
βœ… Error Handling - Graceful failures with detailed logging
βœ… Unicode Support - Proper UTF-8 encoding for Nepali Devanagari script
βœ… No Database Required - Lightweight JSON file storage
βœ… GitHub-Hosted - Free hosting and CDN via GitHub Raw

πŸ“š Documentation

Document Description
Quick Start Get up and running in minutes
API Usage Guide Complete API documentation with examples
Contributing Guide How to add new news sources
Automation Guide Set up automated scraping

πŸ“ Use Cases

  • πŸ“± News Apps - Build mobile or web applications with real-time Nepali news
  • πŸ“Š Data Analysis - Research Nepali media trends and content patterns
  • πŸ€– Chatbots - Integrate news feeds into AI assistants
  • πŸ“§ News Digests - Create automated news summary emails
  • πŸ”” Alert Systems - Monitor specific topics or keywords
  • πŸ“š Archive Projects - Build historical news databases

🀝 Contributing

Contributions are welcome! Whether you want to add a new news source, fix bugs, or improve documentation:

  1. πŸ“° Add News Sources - See Contributing Guide
  2. πŸ› Report Bugs - Open an issue
  3. πŸ’‘ Suggest Features - Share your ideas in discussions
  4. ⭐ Star the Repo - Show your support!

πŸ“„ License

See LICENSE for full details.

πŸ“ž Support & Community

πŸ™ Acknowledgments

Special thanks to:

  • All Nepali news sources for providing accessible content
  • The open-source community for inspiration and tools
  • Contributors who help expand and improve this project

Made with ❀️ for the Nepali developer community

⭐ Star on GitHub Β· πŸ“– Documentation Β· πŸ› Report Bug

About

Nepali News API is a free, open-source news aggregation service that scrapes top Nepali news sources and provides clean, structured JSON data. Perfect for developers building news apps, researchers analyzing Nepali media, or anyone needing programmatic access to Nepali news content.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors