GithubHelp home page GithubHelp logo

imsyy / dailyhotapi Goto Github PK

View Code? Open in Web Editor NEW
853.0 853.0 548.0 214 KB

🔥 今日热榜 API,一个聚合热门数据的 API 接口,支持 Vercel 部署 | 前端页面:https://github.com/imsyy/DailyHot

Home Page: https://hot.imsyy.top

License: MIT License

Dockerfile 1.01% TypeScript 98.99%

dailyhotapi's Introduction

logo

今日热榜

一个聚合热门数据的 API 接口

🚩 特性

  • 极快响应,便于开发
  • 支持 RSS 模式和 JSON 模式
  • 支持多种部署方式
  • 简明的路由目录,便于新增

👀 示例

这里是使用该 API 的示例站点
示例站点可能由于访问量或者长久未维护而访问异常
若您也使用了本 API 搭建了网站,欢迎提交您的站点链接

🎉 总览

🟢 状态正常 / 🟠 可能失效 / ❌ 无法使用 / ⚠️ 需要科学上网

站点 类别 调用名称 状态
哔哩哔哩 热门榜 bilibili 🟢
AcFun 排行榜 acfun 🟢
微博 热搜榜 weibo 🟢
知乎 热榜 zhihu 🟢
知乎日报 推荐榜 zhihu-daily 🟢
百度 热搜榜 baidu 🟢
抖音 热点榜 douyin 🟢
豆瓣电影 新片榜 douban-movie 🟢
豆瓣讨论小组 讨论精选 douban-group 🟢
百度贴吧 热议榜 tieba 🟢
少数派 热榜 sspai 🟢
IT之家 热榜 ithome 🟠
IT之家「喜加一」 最新动态 ithome-xijiayi 🟠
简书 热门推荐 jianshu 🟠
澎湃新闻 热榜 thepaper 🟢
今日头条 热榜 toutiao 🟢
36 氪 热榜 36kr 🟢
51CTO 推荐榜 51cto 🟢
稀土掘金 热榜 juejin 🟢
腾讯新闻 热点榜 qq-news 🟢
网易新闻 热点榜 netease-news 🟢
虎嗅 24小时 huxiu 🟢
爱范儿 快讯 ifanr 🟢
英雄联盟 更新公告 lol 🟢
原神 最新消息 genshin 🟢
崩坏3 最新动态 honkai 🟢
崩坏:星穹铁道 最新动态 starrail 🟢
微信读书 飙升榜 weread 🟢
NGA 热帖 ngabbs 🟢
V2EX 主题榜 v2ex ⚠️
HelloGitHub Trending hellogithub 🟢
**气象台 全国气象预警 weatheralarm 🟢
**地震台 地震速报 earthquake 🟢

⚙️ 部署

具体使用说明可参考 我的博客,下方仅讲解基础操作:

Docker 部署

安装及配置 Docker 将不在此处说明,请自行解决

本地构建

# 构建
docker build -t dailyhot-api .
# 运行
docker run -p 6688:6688 -d dailyhot-api
# 或使用 Docker Compose
docker-compose up -d

在线部署

# 拉取
docker pull imsyy/dailyhot-api:latest
# 运行
docker run -p 6688:6688 -d imsyy/dailyhot-api:latest

手动部署

最直接的方式,您可以按照以下步骤将 DailyHotApi 部署在您的电脑、服务器或者其他任何地方

安装

git clone https://github.com/imsyy/DailyHotApi.git
cd DailyHotApi

然后再执行安装依赖

npm install

开发

npm run dev

成功启动后程序会在控制台输出可访问的地址

编译运行

npm run build
npm run start

成功启动后程序会在控制台输出可访问的地址

Railway 部署

本项目支持使用 Railway 一键部署,请先将本项目 fork 到您的仓库中,即可使用一键部署。

Zeabur 部署

本项目支持使用 Zeabur 一键部署,请先将本项目 fork 到您的仓库中,即可使用一键部署。

Vercel 部署

🚧 Vercel 部署支持正在修复中

若您目前仅能通过 Vercel 进行部署,那么请暂时不要使用最新版本

⚠️ 须知

  • 本项目为了避免频繁请求官方数据,默认对数据做了缓存处理,默认为 60 分钟,如需更改,请自行修改配置
  • 本项目部分接口使用了 页面爬虫,若违反对应页面的相关规则,请 及时通知我去除该接口

📢 免责声明

  • 本项目提供的 API 仅供开发者进行技术研究和开发测试使用。使用该 API 获取的信息仅供参考,不代表本项目对信息的准确性、可靠性、合法性、完整性作出任何承诺或保证。本项目不对任何因使用该 API 获取信息而导致的任何直接或间接损失负责。本项目保留随时更改 API 接口地址、接口协议、接口参数及其他相关内容的权利。本项目对使用者使用 API 的行为不承担任何直接或间接的法律责任
  • 本项目并未与相关信息提供方建立任何关联或合作关系,获取的信息均来自公开渠道,如因使用该 API 获取信息而产生的任何法律责任,由使用者自行承担
  • 本项目对使用 API 获取的信息进行了最大限度的筛选和整理,但不保证信息的准确性和完整性。使用 API 获取信息时,请务必自行核实信息的真实性和可靠性,谨慎处理相关事项
  • 本项目保留对 API 的随时更改、停用、限制使用等措施的权利。任何因使用本 API 产生的损失,本项目不负担任何赔偿和责任

😘 鸣谢

特此感谢为本项目提供支持与灵感的项目

⭐ Star History

Star History Chart

dailyhotapi's People

Contributors

aomd avatar imsyy avatar jymusic0663 avatar myfaith avatar wp0403 avatar x-dr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dailyhotapi's Issues

添加数据库缓存上次爬取的数据,防止由于爬取失败导致没有数据可以展示

问题描述

大佬你好!感谢你的项目!我最近遇到了B站上时不时的抓取不到,导致没有信息可以显示,请问可以设置一个数据库保存上次爬取的信息吗?因为我发现B站上的数据变动并不是很大,相比于直接显示爬取失败报错,稍微延迟一点并不会影响体验,但是我不太会改,如果大佬有解决方法并且有空闲时间可以麻烦实现一下,我只是稍微提点建议,感谢大佬的项目!

补充信息

No response

bilibili 接口出错

问题描述

尝试访问b站接口时报错

get xxx/bilibili

显示错误;

Cannot read properties of undefined (reading 'list')

补充信息

其他接口可以正常使用

vercel.json不兼容最新规则,最新版本部署会报500错误

问题描述

{
"version": 2,
"functions": {
"api/index.js": {
"runtime": "@vercel/[email protected]"
}
},
"rewrites": [
{
"source": "/(.)",
"destination": "/"
}
],
"headers": [{
"source": "/(.
)",
"headers": [
{
"key": "Access-Control-Allow-Credentials",
"value": "true"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Access-Control-Allow-Methods",
"value": "GET,OPTIONS,PATCH,DELETE,POST,PUT"
},
{
"key": "Access-Control-Allow-Headers",
"value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version"
}
]
}]
} 我改了一下,但还是不能正常运行,会报错

补充信息

无论怎么改,最新部署会报500错误

很奇怪,不知道是后端问题还是前端问题

问题描述

image
我明明是一起刷新的,但是每次进界面 头条还有掘金、LOL等显示的却是23小时前,然后手动刷新后
image
就是正常的三小时前一起批量更新的数据和时间,但是刷新浏览器后,就又变成23小时前更新的数据和时间

补充信息

No response

Vercel报错

问题描述

报错信息:
404: NOT_FOUND
Code: NOT_FOUND
ID: hkg1::ttcf9-1715435824697-84eaad47f481

补充信息

No response

知乎日报无法加载,用的是自己搭建的api

问题描述

image
api所在的服务器是腾讯香港轻量。用docker按照教程部署的。
docker日志里有这么一条报错。
error: 出现致命错误:Error: Hostname/IP does not match certificate's altnames: Host: news-at.zhihu.com. is not in the cert's altnames

补充信息

No response

求助

请问api可以部署到虚拟空间上吗?

hot.imsyy.top打开404

问题描述

大佬,演示站点hot.imsyy.top404了。
源码大件之后也是加载不出来,麻烦抽空修复一下呗

补充信息

No response

应该如何正确设置 ALLOWED_DOMAIN?

问题描述

我的 api 地址:api.daydayday.com
前端地址:daydayday.com
.env 里的 只有设置 ALLOWED_DOMAIN = '*' 时才能正确获取到信息

而设置为 ALLOWED_DOMAIN = 'api.daydayday.com' 时,会提示:{"code":403,"message":"请通过正确的域名访问"}

补充信息

No response

不知道能不能结合到一为导航里面用

问题描述

这是官方的代码
`<?php
/*

  • @theme Name:One Nav

  • @theme URI:https://www.iotheme.cn/

  • @author: iowen

  • @author URI: https://www.iowen.cn/

  • @Date: 2021-06-03 08:55:58

  • @LastEditors: iowen

  • @LastEditTime: 2023-02-08 17:14:22

  • @filepath: \onenav\inc\hot-search.php

  • @description:
    */
    if ( ! defined( 'ABSPATH' ) ) { exit; }
    function hot_search($hot_data){
    $t= mt_rand();
    $type = isset($hot_data['hot_type'])?$hot_data['hot_type']:'api';
    switch ($type){
    case "api":
    $api = "//ionews.top/api/get.php";
    $key = iowenKey();
    $title = $hot_data['name'];
    $ico = $hot_data['ico'];
    $iframe = $hot_data['is_iframe'];
    $rule_id = $hot_data['rule_id'];
    include( get_theme_file_path('/templates/hot/hot-api.php') );
    break;
    case "rss":
    case "json":
    $custom_api = get_option( 'io_hot_search_list' )[$type.'_list'];
    $rule_id = $hot_data['rule_id'];
    $custom_data= $custom_api[$rule_id-1];
    $api = $custom_data['url'];
    $title = $custom_data['name'];
    $subtitle = $custom_data['subtitle'];
    $ico = $hot_data['ico'];
    $iframe = $hot_data['is_iframe'];

         $datas_node = $custom_data['datas'];
         $title_node = $custom_data['title'];
         $link_node  = $custom_data['link'];
         $hot_node   = $custom_data['hot'];
    
         $link_regular = isset($custom_data['link_regular'])?$custom_data['link_regular']:'';
         include( get_theme_file_path('/templates/hot/hot-json.php') ); 
         break;
     default:
         include( get_theme_file_path('/templates/hot/hot-api.php') ); 
    

    }
    }

add_action('wp_ajax_nopriv_get_hot_data', 'io_get_hot_search_data');
add_action('wp_ajax_get_hot_data', 'io_get_hot_search_data');
if(!function_exists('io_get_hot_search_data')) {
function io_get_hot_search_data(){
$rule_id = esc_sql($REQUEST['id']);
$type = esc_sql($REQUEST['type']);
$cache_key = "io_free_hot_data
{$rule_id}
{$type}";

$_data      = get_transient($cache_key);
if($_data)
    io_error(array("status" => 1, "data" => $_data), false, 10);

$_ua = array(
    '[dev]general information acquisition module - level 30 min, version:3.2',
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
);
$default_ua = array('userAgent'=>$_ua[wp_rand(0,2)]);
$custom_api = get_option( 'io_hot_search_list' )[$type.'_list'];
$custom_data= $custom_api[$rule_id-1];
$api_url    = $custom_data['url'];
$api_cache  = isset($custom_data['cache']) ? (int)$custom_data['cache'] : 60;
$api_data   = isset($custom_data['request_data']) ? io_option_data_to_array($custom_data['request_data']) : '';
$api_method = strtoupper(isset($custom_data['request_type']) ? $custom_data['request_type'] : 'get');
$api_header = isset($custom_data['headers']) ? io_option_data_to_array($custom_data['headers'], $default_ua) : $default_ua;
$api_cookie = isset($custom_data['cookies']) ? io_option_data_to_array($custom_data['cookies']) : '';


$http = new Yurun\Util\HttpRequest;
$http->headers($api_header);
if($api_cookie)
    $http->cookies($api_cookie);

$response = $http->send($api_url, $api_data, $api_method);
if(!$response->success){
    io_error(array( "status"=>0,"code"=>$response->httpCode(),"data"=> $response->errno()));
}
if ('json' === $type) {
    $_data = $response->json(true);
}else{
    $_data = json_decode(json_encode($response->xml()),true);
}
if (io_free_hot_is_data($_data, $custom_data['datas'])) {
    // TODO 格式化数据输出?
    $res = array("status" => 1, "data" => $_data);
    $_data['cache_time'] = io_get_time();
    set_transient($cache_key, $_data, $api_cache * MINUTE_IN_SECONDS);
    io_error($res, false, 5);
} else {
    io_error(array( "status"=>0, "code"=>202, "data"=> __("没有获取到内容。",'i_theme'), "res"=>$_data), false, 1);
}

}
}
/**

  • 设置项数据转数组
  • 设置项键名 'key' 'value'
  • @param array $datas
  • @param array $default 预设值
  • @return array
    /
    function io_option_data_to_array($datas, $default = array()){
    $args = $default;
    foreach($datas as $data){
    $args[$data['key']] = $data['value'];
    }
    return $args;
    }
    /
    *
  • 判断获取的内容是否包含数据
  • @param array $datas
  • @param string $nodes
  • @return bool
    */
    function io_free_hot_is_data($datas, $nodes){
    $_nodes = explode('.', $nodes);
    $_data = $datas;
    foreach($_nodes as $node){
    if(isset($_data[$node])){
    $_data = $_data[$node];
    }else{
    return false;
    }
    }
    return !empty($_data);
    }

// 热搜列表
if(!function_exists('all_topnew_list')){
function all_topnew_list(){
$topsearch = array(
array(
'rule_id' => '100000',
'name' => '百度热点',
'description' => '实时热点排行榜 https://top.baidu.com/buzz.php?p=top10',
'ico' => get_hot_ico('baidu'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100001',
'name' => '36氪人气榜',
'description' => '24小时人气阅读 https://www.36kr.com/hot-list/catalog',
'ico' => get_hot_ico('36kr'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100002',
'name' => '吾爱破解热度排行榜',
'description' => '吾爱破解帖子今日热度排行榜',
'ico' => get_hot_ico('wuaipojie'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100003',
'name' => '哔哩哔哩全站排行榜',
'description' => '哔哩哔哩全站排行榜 https://www.bilibili.com/v/popular/rank/all',
'ico' => get_hot_ico('bilibili'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100004',
'name' => '豆瓣小组',
'description' => '豆瓣小组讨论精选',
'ico' => get_hot_ico('douban'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100005',
'name' => '历史上的今天',
'description' => 'https://hao.360.com/histoday/',
'ico' => get_hot_ico('lssdjt'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100006',
'name' => '少数派热门文章',
'description' => 'https://sspai.com/tag/热门文章',
'ico' => get_hot_ico('sspai'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100007',
'name' => '微博热搜榜',
'description' => 'http://s.weibo.com/top/summary',
'ico' => get_hot_ico('weibo'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100011',
'name' => '微信热搜词',
'description' => '微信热搜词 https://weixin.sogou.com/',
'ico' => get_hot_ico('wechat'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100013',
'name' => '微信读书新书榜',
'description' => '微信读书新书榜 https://weread.qq.com/web/category/newbook',
'ico' => get_hot_ico('weread'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100014',
'name' => '微信读书更新榜',
'description' => '更新榜 https://weread.qq.com/web/category/novel_male_series',
'ico' => get_hot_ico('weread'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100015',
'name' => '知乎热度',
'description' => '知乎热度 https://www.zhihu.com/hot',
'ico' => get_hot_ico('zhihu'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100016',
'name' => '电商报7X24h快讯',
'description' => '7X24h快讯 https://www.dsb.cn/news',
'ico' => get_hot_ico('dsb'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100017',
'name' => '什么值得买',
'description' => '什么值得买精选好价 https://www.smzdm.com/jingxuan/',
'ico' => get_hot_ico('smzdm'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100018',
'name' => '豆瓣电影排行榜',
'description' => '豆瓣电影排行榜,豆瓣新片榜',
'ico' => get_hot_ico('douban'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100020',
'name' => '抖音热点榜',
'description' => '抖音热点榜 https://www.iesdouyin.com/share/billboard/',
'ico' => get_hot_ico('douyin'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100038',
'name' => '抖音今日热门视频',
'description' => '抖音今日热门视频 https://www.iesdouyin.com/share/billboard/',
'ico' => get_hot_ico('douyin'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100027',
'name' => 'IT之家资讯热榜',
'description' => 'IT之家资讯热榜 https://www.ithome.com',
'ico' => get_hot_ico('ithome'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100028',
'name' => 'IT之家最新资讯',
'description' => 'IT之家IT资讯最新 https://it.ithome.com/',
'ico' => get_hot_ico('ithome'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100029',
'name' => '百度贴吧热议榜',
'description' => '百度贴吧热议榜 http://tieba.baidu.com/hottopic/browse/topicList?res_type=1',
'ico' => get_hot_ico('baidu'),
'is_iframe' => false,
'hot_type' => 'api'
),
array(
'rule_id' => '100030',
'name' => '虎扑步行街热帖',
'description' => '虎扑步行街热帖 https://bbs.hupu.com/all-gambia',
'ico' => get_hot_ico('hupu'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100036',
'name' => '哔哩哔哩综合热门',
'description' => '综合热门 https://www.bilibili.com/v/popular/all',
'ico' => get_hot_ico('bilibili'),
'is_iframe' => true,
'hot_type' => 'api'
),
array(
'rule_id' => '100037',
'name' => '哔哩哔哩入站必刷',
'description' => '入站必刷 https://www.bilibili.com/v/popular/history',
'ico' => get_hot_ico('bilibili'),
'is_iframe' => true,
'hot_type' => 'api'
),
);
$topsearch = apply_filters('io_topnew_list_filters', $topsearch);
return $topsearch;
}
}

function get_hot_ico($ico_name){
return get_theme_file_uri('/images/hotico/'.$ico_name.'.png');
}
//https://feed.mix.sina.com.cn/api/roll/get?pageid=153&lid=2509&k=&num=50&page=1&r=0.466137586907422&callback=jQuery11120153213739791773_1633014950125&_=1633014950127
//http://zhibo.sina.com.cn/api/zhibo/feed?callback=jQuery1112042151262348278307_1583126404217&page=1&page_size=20&zhibo_id=152&tag_id=0&dire=f&dpc=1&pagesize=20&id=1638768&type=0&_=1583126404220
//http://zhibo.sina.com.cn/api/zhibo/feed?callback=jQuery1112042151262348278307_1583126404217&page=1&page_size=20&zhibo_id=152&tag_id=0&dire=f&dpc=1&pagesize=20&id=1638768&type=0&_=1583126404221
//http://zhibo.sina.com.cn/api/zhibo/feed?page=1&page_size=20&zhibo_id=152&tag_id=0&dire=f&dpc=1&pagesize=20&_=1583119028651
//
`

补充信息

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.