Skip to content

Shineii86/AniNewsAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

123 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Note

The old deployment URL https://aninewsapi.vercel.app/ is no longer accessible. Use the current URL: https://aninews.vercel.app/

πŸ“° AniNewsAPI

Real-time Anime News Aggregation API

Vercel Version Node License Sources Status

API Status Last Commit Repo Size Stars Forks

A serverless API aggregating anime news from 7 sources in real-time β€” with smart caching, keyword search, RSS feeds, and full-article extraction.


πŸš€ Quick Start Β· πŸ“‘ API Docs Β· πŸ—žοΈ Sources Β· πŸ—οΈ Architecture Β· 🀝 Contributing


πŸ“Š At a Glance

πŸ“‘ 7 Sources
ANN Β· MAL Β· Crunchyroll
Anime Corner Β· Otaku USA
Anime Herald Β· Comic Book
⚑ 11 Endpoints
News Β· Search Β· RSS Β· SSE
Tags Β· Slug Β· Health
Stats Β· OpenAPI Β· Cache
πŸš€ ~200ms
Cached responses
10-min auto-refresh
Cross-source dedup
πŸ“° 60+ Articles
Full-text search
RSS 2.0 feed
Pagination support

✨ Features

⚑ Core

  • Real-time scraping from 7 anime news sources
  • Smart caching with 10-minute TTL + disk backup
  • Concurrent fetching β€” all sources hit simultaneously
  • Retry logic β€” 3 attempts per source with exponential backoff
  • Graceful degradation β€” if a source fails, others continue

πŸ” Data

  • Keyword search with relevance scoring (/api/search)
  • RSS 2.0 feed for readers & integrations (/api/rss)
  • Full article extraction by slug (/api/news/:slug)
  • Tag filtering with article counts (/api/news/tags)
  • Pagination via offset + limit parameters

πŸ›‘οΈ Reliability

  • RSS fallback when web scraping is blocked
  • Google News proxy for Cloudflare-protected sources
  • Cross-source deduplication by normalized title
  • Timeout protection β€” 15s per source, never hangs
  • CORS enabled β€” works from any frontend

πŸš€ Deployment

  • Zero-config Vercel deployment
  • Serverless functions β€” scales automatically
  • Express mode β€” run standalone with npm start
  • Environment variables for TTL customization
  • ~50KB total codebase, no heavy dependencies

πŸ—žοΈ News Sources

Source Key Method Articles
Anime News Network ann Google News RSS ~15
Anime Corner animecorner Direct Scraping ~12
MyAnimeList myanimelist Direct Scraping ~15
Otaku USA Magazine otakuusa Google News RSS ~12
Crunchyroll crunchyroll Google News RSS ~15
Anime Herald animeherald RSS Feed ~10
Comic Book comicbook Direct Scraping ~10

Total: 60+ unique articles after cross-source deduplication


πŸ—οΈ Architecture

Request Flow

Stage Component Description
1 Client Browser, app, or curl sends request
2 Vercel Edge / Express Routes request, applies CORS + rate limit headers
3 Cache Check node-cache with 10-min TTL β€” hit = instant response
4 Fetch Sources 7 concurrent scrapers (3 retries each, 15s timeout)
5 Deduplicate Cross-source dedup by normalized title
6 Enrich & Respond Paginate, sort, format β†’ JSON/RSS/SSE

Endpoints

Endpoint Method Description
/api/news GET Latest news with pagination, sorting, source filtering
/api/news/tags GET Tag listing with counts, or filter by tag
/api/news/:slug GET Full article content extraction
/api/search GET Full-text search with relevance scoring
/api/rss GET RSS 2.0 XML feed
/api/health GET Status, version, uptime
/api/stats GET Cache hit/miss metrics
/api/stream GET Server-Sent Events for real-time push
/api/openapi GET OpenAPI 3.0.3 specification
/api/cache/clear POST Manual cache flush

Sources

Source Key Method
Anime News Network ann Google News RSS
Anime Corner animecorner Direct Scrape
MyAnimeList myanimelist Direct Scrape
Otaku USA otakuusa Google News RSS
Crunchyroll crunchyroll Google News RSS
Anime Herald animeherald RSS Feed
Comic Book comicbook Direct Scrape

πŸ“‘ API Endpoints

GET /api/news

Latest anime news from all or specific sources.

Param Type Default Description
limit 1-100 20 Max articles
offset β‰₯0 0 Pagination offset
sort latest|oldest latest Sort order
source string all Filter by source key
refresh boolean false Bypass cache
curl "https://aninews.vercel.app/api/news?limit=10"
curl "https://aninews.vercel.app/api/news?source=crunchyroll&limit=10&offset=10"
πŸ“„ Example Response
{
  "success": true,
  "data": [{ "title": "Demon Slayer Season 4 Announced", "slug": "ann-demon-slayer-season-4-announced", "source": "Anime News Network", "excerpt": "...", "date": "2026-05-07T10:30:00.000Z", "image": "...", "link": "...", "tags": ["news", "anime"] }],
  "meta": { "total": 62, "returned": 10, "offset": 0, "limit": 10, "hasMore": true, "source": "all", "sort": "latest", "responseTime": "234ms" }
}

GET /api/search

Full-text search with relevance scoring. Title matches rank higher than excerpt matches.

Param Required Description
q βœ… Search query (min 2 chars)
source ❌ Filter by source
limit ❌ Max results
offset ❌ Pagination
curl "https://aninews.vercel.app/api/search?q=demon+slayer"
curl "https://aninews.vercel.app/api/search?q=manga&source=ann&limit=5"

GET /api/news/tags

List available tags with counts, or filter articles by tag.

curl "https://aninews.vercel.app/api/news/tags"
curl "https://aninews.vercel.app/api/news/tags?tag=official"

GET /api/news/:slug

Full article content extraction.

curl "https://aninews.vercel.app/api/news/ann-demon-slayer-season-4-announced"

GET /api/rss

Standard RSS 2.0 XML feed. Works with any feed reader.

Param Default Description
source all Filter by source
limit 20 Max items
curl "https://aninews.vercel.app/api/rss"
curl "https://aninews.vercel.app/api/rss?source=crunchyroll&limit=10"

GET /api/health Β· GET /api/stats Β· POST /api/cache/clear

Health check, cache statistics, and manual cache flush.


GET /api/stream

Server-Sent Events (SSE) stream for real-time article notifications. Clients receive new_article events as they're fetched and heartbeat events every 30s to keep the connection alive.

curl -N "https://aninews.vercel.app/api/stream"

GET /api/openapi

OpenAPI 3.0.3 specification in JSON format. Use with Swagger UI, Postman, or any OpenAPI-compatible tool.

curl "https://aninews.vercel.app/api/openapi"

πŸš€ Quick Start

Deploy to Vercel

Deploy with Vercel

Local Development

git clone https://github.com/Shineii86/AniNewsAPI.git
cd AniNewsAPI && npm install && npm run dev
# β†’ http://localhost:3000

πŸ”§ Configuration

Variable Default Description
CACHE_TTL 600 Cache duration in seconds
PORT 3000 Server port (Express mode)

πŸ“Š Performance

Metric Value
Cached response ~200ms
Fresh fetch (all 7) ~3-6s
Cache TTL 10 minutes
Retry attempts 3 per source
Timeout per source 15 seconds
Total articles (avg) 60+ after dedup

πŸ› οΈ Tech Stack

Layer Technology
Runtime Node.js β‰₯ 18
HTTP Express 5 / Vercel Functions
Scraping Cheerio + Axios
RSS rss-parser
Caching node-cache + filesystem

πŸ“ Project Structure

AniNewsAPI/
β”œβ”€β”€ api/                    # Vercel serverless functions
β”‚   β”œβ”€β”€ cache/clear.js      # Cache management
β”‚   β”œβ”€β”€ health.js           # Health check
β”‚   β”œβ”€β”€ news.js             # Main news endpoint
β”‚   β”œβ”€β”€ news/{slug}.js      # Article by slug
β”‚   β”œβ”€β”€ news/tags.js        # Tag filtering
β”‚   β”œβ”€β”€ rss.js              # RSS feed
β”‚   β”œβ”€β”€ search.js           # Keyword search
β”‚   β”œβ”€β”€ stats.js            # Cache statistics
β”‚   β”œβ”€β”€ stream.js           # SSE real-time feed
β”‚   └── openapi.js          # OpenAPI 3.0 spec
β”œβ”€β”€ utils/                  # Core logic
β”‚   β”œβ”€β”€ cacheHandler.js     # Memory + disk cache
β”‚   β”œβ”€β”€ constants.js        # Shared config
β”‚   β”œβ”€β”€ contentParser.js    # Article extraction
β”‚   β”œβ”€β”€ dateParser.js       # Multi-format date parsing
β”‚   β”œβ”€β”€ fetch*.js           # Source scrapers (7 files)
β”‚   └── generateSlug.js     # URL-safe slug generator
β”œβ”€β”€ public/index.html       # Landing page (v4.0)
β”œβ”€β”€ server.js               # Express server entry
β”œβ”€β”€ vercel.json             # Vercel routing config
└── CHANGELOG.md

🀝 Contributing

Add a New Source

  1. Create utils/fetchNewSource.js β€” export async function returning [{ title, slug, source, excerpt, date, image, link, tags }]
  2. Register in api/news.js β†’ SOURCES object
  3. Test with npm test, submit a PR

πŸ“„ License

MIT Β© Shinei Nouzen


πŸ™ Acknowledgments

Source About
Anime News Network Industry-leading anime journalism
Anime Corner Community-driven anime news & polls
MyAnimeList The largest anime/manga database
Otaku USA Magazine English-language anime culture magazine
Crunchyroll Official streaming platform news
Anime Herald Anime news, reviews & editorials
Comic Book Anime & manga coverage at ComicBook

Built with ❀️ for the anime community

Telegram GitHub Instagram Gmail

⭐ Star this repo Β· πŸ› Report a bug Β· πŸ’‘ Request a feature

About

Powerful Anime News API - real-time aggregation from 7 sources with smart caching, keyword search, RSS feeds, and full-article extraction.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors