友情提示点击顶部放大镜 可以使用站内搜索 记住我们的地址 www.hainabaike.com
百度热榜API源码
百度热点api前端效果
百度热点指数api
<?php // 百度热点 指数 function baiduredian() { $_resHtml = str_replace([" ", " ", " "], '', vvhanCurl('https://top.baidu.com/board?tab=realtime', null)); preg_match('/<!--s-data:(.*?)-->/', $_resHtml, $_resHtmlArr); $jsonRes = json_decode($_resHtmlArr[1], true); return $jsonRes; $tempArr = []; foreach ($jsonRes['data']['cards'] as $v) { foreach ($v['content'] as $k => $_v) { array_push($tempArr, [ 'index' => $k + 1, 'title' => $_v['word'], 'desc' => $_v['desc'], 'pic' => $_v['img'], 'url' => $_v['url'], 'hot' => $_v['hotScore'] . 'W个内容', 'mobilUrl' => $_v['appUrl'] ]); } } return [ 'success' => true, 'title' => '百度热点', 'subtitle' => '指数', 'update_time' => date('Y-m-d h:i:s', time()), 'data' => $tempArr ]; } ?>
知乎热榜api
<?php // 知乎热榜 热度 function zhihuHot() { $_resHtml = str_replace([" ", " ", " "], '', vvhanCurl('https://www.zhihu.com/hot', ['User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'], 'https://www.zhihu.com')); preg_match('/<scriptid="js-initialData"type="text/json">(.*?)</script>/', $_resHtml, $_resHtmlArr); $jsonRes = json_decode($_resHtmlArr[1], true); $tempArr = []; foreach ($jsonRes['initialState']['topstory']['hotList'] as $k => $v) { array_push($tempArr, [ 'index' => $k + 1, 'title' => $v['target']['titleArea']['text'], 'desc' => $v['target']['excerptArea']['text'], 'pic' => $v['target']['imageArea']['url'], 'hot' => $v['target']['metricsArea']['text'], 'url' => $v['target']['link']['url'], 'mobilUrl' => $v['target']['link']['url'] ]); } return [ 'success' => true, 'title' => '知乎热榜', 'subtitle' => '热度', 'update_time' => date('Y-m-d h:i:s', time()), 'data' => $tempArr ]; } ?>
标签: 网站源码
文章来源:
聚萌博客
版权声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除。
评论列表