imsyy / dailyhotapi Goto Github PK
View Code? Open in Web Editor NEW🔥 今日热榜 API,一个聚合热门数据的 API 接口,支持 Vercel 部署 | 前端页面:https://github.com/imsyy/DailyHot
Home Page: https://hot.imsyy.top
License: MIT License
🔥 今日热榜 API,一个聚合热门数据的 API 接口,支持 Vercel 部署 | 前端页面:https://github.com/imsyy/DailyHot
Home Page: https://hot.imsyy.top
License: MIT License
请问api可以部署到虚拟空间上吗?
it之家获取失败了
No response
关掉豆瓣新片榜后,网站加载正常
No response
作者可出个详细使用说明吗,折磨不透啊,api的+bilibili访问404,不是403
No response
小白不太搞得懂啊·
No response
另外问下怎么编译打包 发布在国内服务器上
这是官方的代码
`<?php
/*
@theme Name:One Nav
@author: iowen
@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(){
$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);
}
}
}
/**
// 热搜列表
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
对这门后端语言不熟悉,请问up 这个项目如何打包呢。请指教
No response
老板把网易也加上吧
我的 api 地址:api.daydayday.com
前端地址:daydayday.com
.env 里的 只有设置 ALLOWED_DOMAIN = '*' 时才能正确获取到信息
而设置为 ALLOWED_DOMAIN = 'api.daydayday.com' 时,会提示:{"code":403,"message":"请通过正确的域名访问"}
No response
虽然网上有docker部署的教程,但希望大佬能出个官方docker的镜像,用docker部署在自己的NAS或者服务器上
No response
{
"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错误
感觉接口太少了,澎湃腾讯百度头条都是新闻资讯类的,不知道大佬有没有时间加几个其它类型的接口,像微信读书、豆瓣电影、抖音、还有360的历史上的今天:https://hao.360.com/histoday/
No response
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.