1.溯源(F12打开开发者工具监听今日头条官网,如图所示找到 API 数据接口)
![](https://cdn.dabenshi.cn/dabenshi/posts/2024-06/Dabenshi-Blog-20240605151817.webp)
![](https://cdn.dabenshi.cn/dabenshi/posts/2024-06/Dabenshi-Blog-20240605152022.webp)
2.溯源请求
![](https://cdn.dabenshi.cn/dabenshi/posts/2024-06/Dabenshi-Blog-20240605153719.webp)
3.热榜爬取(头条提供的数据相比抖音多一些,也更全面)
4.调用接口
请求方式:
GET
请求地址:
https://dabenshi.cn/other/api/hot.php?type=toutiaoHot
请求参数:
//持续更新、完善,有疑问的小伙伴欢迎来信~
'index' => $k + 1,//热榜序号
'title' => $v['Title'],//热榜标题
'url' => ''.$v['Url'],//热榜URL
'image_url' => $v['Image']['url'],//头图URL
'image_width' => $v['Image']['width'], // 图片宽度
'image_height' => $v['Image']['height'], // 图片高度
'label' => isset($v['Label']) ? $v['Label'] : null, // 标签
'label_url' => isset($v['LabelUrl']) ? $v['LabelUrl'] : null, // 标签URL
'hot_value' => round($v['HotValue']/10000,1).'万',//热度
返回格式:
JSON
返回示例:
{"success": true,"data":数组数据}
使用说明:
欢迎感兴趣的朋友调试使用,严禁滥用接口,谢谢。
5.最终效果
![](https://cdn.dabenshi.cn/dabenshi/posts/2024-06/Dabenshi-Blog-20240605165040.webp)
评论 16