Code Monkey home page Code Monkey logo

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

dailyhotapi's Issues

求助

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

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

问题描述

这是官方的代码
`<?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

应该如何正确设置 ALLOWED_DOMAIN?

问题描述

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

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

补充信息

No response

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

hot.imsyy.top打开404

问题描述

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

补充信息

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.