DailyHotApi

repository·master·Indexed 26 days ago

https://github.com/imsyy/dailyhotapi

An aggregator API that provides trending data from multiple Chinese social media, news, and gaming platforms in JSON and RSS formats. It supports a wide range of sources including Bilibili, Weibo, Zhihu, Douyin, and GitHub. The project can be integrated into Node.js applications via the dailyhot-api package or deployed using Docker, PM2, Vercel, Railway, and Zeabur.

Tokens
3.9K
Snippets
11
Records
30
Agent score
88%

What's inside dailyhot-api

  1. Overview of DailyHotApi

    master
    DailyHotApi is an API service that aggregates trending data from various platforms. It provides fast response times and supports both RSS and JSON formats. It is designed to be easily extensible with a simple routing directory for adding new data sources.
  2. One-click deployment platforms

    master

    The project supports one-click deployment on several cloud platforms. For most of these, you should first fork the repository to your own account to enable the deployment process.

    • Vercel: Use the Vercel deployment button or visit the dedicated Vercel repository.
    • Railway: Fork the repository and use the Railway one-click deploy feature.
    • Zeabur: Fork the repository and use the Zeabur one-click deploy feature.
  3. Use dailyhot-api in a Node.js application

    master

    You can integrate dailyhot-api directly into your Node.js project by installing the package and calling serveHotApi.

    Note: Using this method may prevent access to certain interfaces that require a Puppeteer environment.

    pnpm add dailyhot-api
    import serveHotApi from "dailyhot-api";
    
    /**
     * Start the server
     * @param {Number} [port] - Port number
     * @returns {Promise<void>}
     */
    serveHotApi(3000);
  4. Manual deployment from source

    master

    To deploy manually on your own machine or server, follow these steps:

    1. Clone the repository and enter the directory.
    2. Install dependencies using npm install.
    3. Copy /.env.example to /.env and configure your settings.
    4. Run in development mode with npm run dev or build and start with npm run build && npm run start.
  5. Deploy DailyhotApi using Docker Compose

    master

    You can deploy the DailyhotApi service using Docker Compose. By default, the service maps port 6688 on the host to port 6688 in the container and persists logs to a local ./logs directory. The service is configured to run as user 114514 and will automatically restart if it fails.

    version: "3.8"
    
    services:
      DailyhotApi:
        build:
          context: .
          target: runner
        ports:
          - "6688:6688"
        volumes:
          - "./logs:/app/logs"
        environment:
          - PORT=6688
        user: "114514"
        restart: always
  6. Configure PM2 deployment with ecosystem.config.cjs

    master

    The project uses a PM2 ecosystem configuration file to manage the application process. You can customize the application name, port, and environment variables by modifying ecosystem.config.cjs before deploying with PM2.

    module.exports = {
      apps: [{
        name: 'daily-news',
        script: 'npm',
        args: 'start',
        instances: 1,
        autorestart: true,
        watch: false,
        max_memory_restart: '1G',
        env: {
          NODE_ENV: 'development',
          PORT: 6688
        }
      }]
    }
  7. Configure dailyhot-api via environment variables

    master

    The dailyhot-api project is configured using environment variables. You can set these in a .env file or directly in your deployment environment. The application uses dotenv to load these values.

    Below is the complete list of available configuration keys, their default values, and their types:

  8. Important usage notes and caching

    master

    To avoid frequent requests to official data sources, the project implements a default cache of 60 minutes. If you need to change this behavior, you must modify the configuration in your .env file.

    Warning: Some interfaces use web scrapers. Ensure your usage complies with the rules of the target websites.

  9. Reference of available API endpoints

    master

    The API provides endpoints for various platforms. Each endpoint is accessed via a specific identifier. Below is a list of available data sources and their corresponding call names:

    PlatformCategoryCall Name
    BilibiliHot Listbilibili
    AcFunRankingsacfun
    WeiboHot Searchweibo
    ZhihuHot Listzhihu
    Zhihu DailyRecommendedzhihu-daily
    BaiduHot Searchbaidu
    DouyinTrendingdouyin
    KuaishouTrendingkuaishou
    Douban MovieNew Releasesdouban-movie
    Douban GroupDiscussiondouban-group
    TiebaTrendingtieba
    SspaiHot Listsspai
    IT HomeHot Listithome
    IT Home (Xijiayi)Latestithome-xijiayi
    JianshuRecommendedjianshu
    GuokrPopular Articlesguokr
    The PaperHot Listthepaper
    ToutiaoHot Listtoutiao
    36KrHot List36kr
    51CTORecommended51cto
    CSDNRankingscsdn
    NodeSeekLatestnodeseek
    JuejinHot Listjuejin
    QQ NewsTrendingqq-news
    SinaHot Listsina
    Sina NewsTrendingsina-news
    NetEase NewsTrendingnetease-news
    52pojieLists52pojie
    HostlocListshostloc
    Huxiu24 Hourshuxiu
    CoolapkHot Listcoolapk
    HupuStreet Hot Postshupu
    IfanrNews Flashifanr
    League of LegendsUpdate Announcementslol
    MiyousheLatest Newsmiyoushe
    Genshin ImpactLatest Newsgenshin
    Honkai Impact 3rdLatest Newshonkai
    Honkai: Star RailLatest Newsstarrail
    WeChat ReadingRising Listweread
    NGAHot Postsngabbs
    V2EXTopic Listv2ex
    HelloGitHubTrendinghellogithub
    Weather AlarmNational Weather Warningsweatheralarm
    Earthquake StationEarthquake Reportsearthquake
    Today in HistoryMonth-Dayhistory