接口地址:https://cn.apihz.cn/api/xinwen/baidu.php |
---|
返回格式:json |
请求方式:get/post |
请求示例:https://cn.apihz.cn/api/xinwen/baidu.php?id=8&key=8 |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
id | int | 必填 | 用户ID |
key | int | 必填 | 密钥 扫码关注公众号 |
名称 | 类型 | 说明 |
---|---|---|
data.content.word | string | 热搜话题 |
data.content.desc | string | 话题描述 |
data.content.hotChange | string | 热度变化 |
data.content.hotScore | string | 热度值 |
data.content.index | string | 指数排名(数值越小,排名越前) |
data.content.hotTag | string | 热度标签 |
data.content.hotTagImg | string | 热度标签图片 |
data.content.img | string | 热搜图片 |
data.content.url | string | 热搜链接 |
data.topContent | string | TOP热搜榜数据集 |
data.topContent.word | string | TOP热搜话题 |
data.topContent.desc | string | TOP话题描述 |
data.topContent.hotChange | string | TOP热度变化 |
data.topContent.hotScore | string | TOP热度值 |
data.topContent.index | string | TOP热搜排名(数值越小,排名越前) |
data.topContent.hotTag | string | TOP热度标签 |
data.topContent.hotTagImg | string | TOP热度标签图片 |
data.topContent.img | string | TOP热搜图片 |
data.topContent.url | string | TOP热搜链接 |
data.updateTime | string | 热搜更新时间 |
data.typeName | string | 热搜类型 |
exec_time | string | 执行耗时 |
user_ip | string | 客户端IP |
{
"code": 200,
"msg": "请求成功",
"data": {
"content": [{
"word": "与歹徒搏斗民警身中15刀英勇牺牲",
"desc": "6月1日,武汉有一名男子拿刀欲伤人,50岁民警邱建军与歹徒搏斗,身中15刀仍紧追不放。邱建军因失血过多,救治无效牺牲。",
"hotChange": "same",
"hotScore": "4906249",
"index": 0,
"hotTag": "3",
"hotTagImg": "https://search-operate.cdn.bcebos.com/54a1ed72d00cd07334860b0509489d8b.png",
"img": "https://fyb-2.cdn.bcebos.com/hotboard_image/856dffee7f4a5ac039f391db5c681ffb",
"url": "https://www.baidu.com/s?wd=%E4%B8%8E%E6%AD%B9%E5%BE%92%E6%90%8F%E6%96%97%E6%B0%91%E8%AD%A6%E8%BA%AB%E4%B8%AD15%E5%88%80%E8%8B%B1%E5%8B%87%E7%89%BA%E7%89%B2&sa=fyb_news&rsv_dl=fyb_news"
}],
"topContent": {
"word": "推动中华文明重焕荣光",
"desc": "文明如水,润物无声。习近平总书记指出,中国式现代化是中华民族的旧邦新命,必将推动中华文明重焕荣光。",
"hotChange": "same",
"hotScore": "4912251",
"index": 0,
"hotTag": "0",
"hotTagImg": null,
"img": "https://fyb-2.cdn.bcebos.com/hotboard_image/52689b756593524ab741c769264f0b5e",
"url": "https://www.baidu.com/s?wd=%E6%8E%A8%E5%8A%A8%E4%B8%AD%E5%8D%8E%E6%96%87%E6%98%8E%E9%87%8D%E7%84%95%E8%8D%A3%E5%85%89&sa=fyb_news&rsv_dl=fyb_news"
},
"updateTime": "2024-06-03 13:25:00",
"typeName": "realtime"
},
"exec_time": 1.128632,
"ip": "222.64.209.132"
}
错误码 | 说明 |
---|---|
400 | 通讯秘钥不正确! |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2024/5/10 07:11
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://cn.apihz.cn/api/xinwen/baidu.php?id=8&key=8';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://cn.apihz.cn/api/xinwen/baidu.php?id=8&key=8"
)
func main() {
queryUrl := fmt.Sprintf("%s",APIURL)
resp, err := http.Get(queryUrl)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}