Skip to content

Real-time Anime News API that scrapes live articles from Crunchyroll & ANN — supports smart caching, tag filtering, full article content, and Vercel deployment. Built for anime devs.

License

Notifications You must be signed in to change notification settings

Shineii86/AniNewsAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📰 Anime News API

Vercel Scraping Status License Made By

Last Commit Repo Size GitHub Stars GitHub Forks API Status

🛰️ A real-time, blazing-fast, tag-filterable Anime News API that fetches fresh articles from multiple reliable sources with smart caching for optimal performance.


📦 Features

  • Real-time Scraping (no database required)
  • 🔁 Smart Caching with auto-refresh (15 minutes)
  • 🏷️ Filter by tags and sources
  • 📄 Fetch full article content by slug
  • 🧩 Multi-source support: 5 reliable anime news sources
  • 📥 Ready-to-deploy on Vercel
  • 🚀 Improved Error Handling and response structure
  • 🔄 Concurrent Fetching for better performance

🗞️ News Sources

Source Description Type
Anime News Network Industry-leading anime news Official
Anime Corner Community-driven anime news Community
MyAnimeList Popular anime database news Official
Otaku USA Magazine Anime culture magazine Community
Crunchyroll Official anime streaming news Official

📡 API Endpoints

GET /api/news (✅ Stable)

Returns the latest anime news articles from all sources.

Query Parameters:

Param Type Default Description
limit Number 10 Max number of articles (1-50)
sort String latest latest or oldest
source String all Source filter (see available sources below)

Available Sources:

  • all - All sources (default)
  • ann - Anime News Network
  • animecorner - Anime Corner
  • myanimelist - MyAnimeList
  • otakuusa - Otaku USA Magazine
  • crunchyroll - Crunchyroll

Example Response:

{
  "success": true,
  "data": [
    {
      "title": "New Anime Series Announced",
      "slug": "ann-new-anime-series-announced",
      "source": "Anime News Network",
      "excerpt": "A new anime series has been announced...",
      "date": "2024-01-15T10:30:00.000Z",
      "image": "https://example.com/image.jpg",
      "link": "https://www.animenewsnetwork.com/news/...",
      "tags": ["news", "anime-news-network"]
    }
  ],
  "meta": {
    "total": 10,
    "source": "all",
    "sort": "latest",
    "limit": 10,
    "timestamp": "2024-01-15T10:30:00.000Z",
    "availableSources": ["all", "ann", "animecorner", "myanimelist", "otakuusa", "crunchyroll"]
  }
}

Example Requests:

GET /api/news?source=ann&limit=5&sort=latest
GET /api/news?source=animecorner&limit=3
GET /api/news?limit=20&sort=oldest

GET /api/news/tags (⚠️ Experimental)

Filter articles by tags (currently supports Crunchyroll only).

Query Parameters:

Param Type Required Description
tag String Yes Tag to filter by

Example:

GET /api/news/tags?tag=official

GET /api/news/[slug] (✅ Stable)

Get full article content by slug.

Example:

GET /api/news/ann-new-anime-series-announced

🚀 Quick Start

Deploy to Vercel

Deploy with Vercel

Local Development

# Clone the repository
git clone https://github.com/Shineii86/AniNewsAPI.git
cd AniNewsAPI

# Install dependencies
npm install

# Start development server
npm run dev

# API will be available at http://localhost:3000

🔧 Configuration

Environment Variables

# Optional: Set cache duration (in seconds)
CACHE_TTL=900

# Optional: Set Chrome executable path for Puppeteer
CHROME_EXECUTABLE_PATH=/usr/bin/chromium-browser

Caching

The API uses a two-tier caching system:

  • Memory Cache: Fast in-memory storage (15 minutes TTL)
  • File Cache: Persistent disk storage for backup

📊 Performance

  • Response Time: ~200-500ms (cached)
  • Concurrent Sources: 5 sources fetched simultaneously
  • Cache Duration: 15 minutes
  • Rate Limiting: Built-in via Vercel
  • Uptime: 99.9%+

🛠️ Technical Details

Architecture

  • Runtime: Node.js (Vercel Functions)
  • Scraping: Cheerio + Axios
  • Caching: Node-cache + File system
  • Deployment: Vercel Serverless Functions

Error Handling

  • Graceful fallback when sources fail
  • Detailed error logging
  • Structured error responses
  • Timeout protection (10s per source)

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Adding New Sources

To add a new anime news source:

  1. Create a new scraper in utils/fetchNewSource.js
  2. Follow the existing pattern for data structure
  3. Add the source to api/news.js
  4. Update the README documentation
  5. Test thoroughly

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments


🔗 Links


Made with ❤️ for the anime community

⭐ Star this repo if you find it useful!

About

Real-time Anime News API that scrapes live articles from Crunchyroll & ANN — supports smart caching, tag filtering, full article content, and Vercel deployment. Built for anime devs.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •