今日热榜
ALAPI 官方文档
今日热榜提供各站热榜聚合:微信、今日头条、百度、知乎、V2EX、微博、贴吧、豆瓣、天涯、虎扑、Github、抖音...追踪全网热点、简单高效阅读
基本说明:
接口地址:https://v2.alapi.cn/api/tophub/get
返回格式:json
请求方式:get/post
请求示例:https://v2.alapi.cn/api/tophub/get?token=token
请求参数说明:
名称 类型 必填 说明
token string 必填 请求token 扫码关注公众号
type string 选填 加密的方式,获取热榜的 type ,默认 36k,所有列表:zhihu 知乎热榜 weibo 微博热搜 weixin 微信 ‧ 24h热文榜 baidu 百度 ‧ 实时热点 toutiao 今日头条 163 网易新闻 xl 新浪网 ‧ 热词排行榜 36k 36氪 ‧ 24小时热榜(默认) hitory 历史上的今天 sspai 少数派 csdn **csdn **今日推荐 juejin 掘金热榜 bilibili 哔哩哔哩热榜 douyin 抖音视频榜 52pojie 吾爱破解热榜 v2ex V2ex 热帖 hostloc 全球主机论坛热帖
返回参数说明:
名称 类型 说明
- - -
JSON返回示例:
{
	"code": 200,
	"msg": "success",
	"data": {
		"date": "20200308",
		"stories": [{
				"image_hue": "0x83b37d",
				"title": "创伤后应激障碍(PTSD)与抑郁症状有何不同?",
				"url": "https://daily.zhihu.com/story/9721287",
				"hint": "Dr.M · 4 分钟阅读",
				"ga_prefix": "030820",
				"images": [
					"https://pic1.zhimg.com/v2-9aaceb95917e280d789d092c15b54174.jpg"
				],
				"type": 0,
				"id": 9721287
			},
			{
				"image_hue": "0x4f3e63",
				"title": "如果机器人可以做大部分工作,《资本论》还有效吗?",
				"url": "https://daily.zhihu.com/story/9721285",
				"hint": "Justin Lee · 4 分钟阅读",
				"ga_prefix": "030816",
				"images": [
					"https://pic4.zhimg.com/v2-05eff424fb1d2ba8d6a9e2e75a514dc3.jpg"
				],
				"type": 0,
				"id": 9721285
			},
			{
				"image_hue": "0xb3947d",
				"title": "如何看待网上五花八门的「寻人服务」?",
				"url": "https://daily.zhihu.com/story/9721278",
				"hint": "牛顿顿顿 · 10 分钟阅读",
				"ga_prefix": "030811",
				"images": [
					"https://pic2.zhimg.com/v2-f5dcd108439e0c823510a416776b2665.jpg"
				],
				"type": 0,
				"id": 9721278
			},
			{
				"image_hue": "0x6d4339",
				"title": "「买熊猫判十年,买妇女最重判三年」是真的吗?",
				"url": "https://daily.zhihu.com/story/9721271",
				"hint": "一丁 · 2 分钟阅读",
				"ga_prefix": "030809",
				"images": [
					"https://pic4.zhimg.com/v2-d3394fb29a024638e78d66375142469b.jpg"
				],
				"type": 0,
				"id": 9721271
			},
			{
				"image_hue": "0x3b4954",
				"title": "洗澡时,元素周期表里的元素挨个飞来会怎样?(二)",
				"url": "https://daily.zhihu.com/story/9721196",
				"hint": "老伏 · 8 分钟阅读",
				"ga_prefix": "030807",
				"images": [
					"https://pic3.zhimg.com/v2-c649d98d3699c61a1f3df1ad52067c62.jpg"
				],
				"type": 0,
				"id": 9721196
			}
		],
		"top_stories": [{
				"image_hue": "0x3b4954",
				"hint": "作者 / 老伏",
				"url": "https://daily.zhihu.com/story/9721187",
				"image": "https://pic2.zhimg.com/v2-1bc6922cc3da00da1326fd15c7b9fc7d.jpg",
				"title": "假如你洗澡时,元素周期表里的元素挨个飞来会怎样?(一)",
				"ga_prefix": "030507",
				"type": 0,
				"id": 9721187
			},
			{
				"image_hue": "0x8f8864",
				"hint": "作者 / 一丁",
				"url": "https://daily.zhihu.com/story/9721127",
				"image": "https://pic4.zhimg.com/v2-b35cc03ed77a6f3bd4892722556b11e7.jpg",
				"title": "如何看待同人作品的法律风险?",
				"ga_prefix": "030409",
				"type": 0,
				"id": 9721127
			},
			{
				"image_hue": "0xb3947d",
				"hint": "作者 / 我是一只小萌刀",
				"url": "https://daily.zhihu.com/story/9720746",
				"image": "https://pic3.zhimg.com/v2-a2e68715865ee4717110c684ff34072e.jpg",
				"title": "历史上有哪些英雄人物在晚年对自己一生的评价?",
				"ga_prefix": "022411",
				"type": 0,
				"id": 9720746
			},
			{
				"image_hue": "0x051e27",
				"hint": "作者 / 羽则",
				"url": "https://daily.zhihu.com/story/9720668",
				"image": "https://pic2.zhimg.com/v2-162fbbfbf55aba80dc8a50c7f989d67d.jpg",
				"title": "你见过最野的黑客什么样?",
				"ga_prefix": "022209",
				"type": 0,
				"id": 9720668
			},
			{
				"image_hue": "0x736650",
				"hint": "作者 / Miss liz",
				"url": "https://daily.zhihu.com/story/9720198",
				"image": "https://pic1.zhimg.com/v2-f6a1c61c36fdf2968d3342b985bf1ac0.jpg",
				"title": "小事 · 串好的糖葫芦,堆在垃圾箱",
				"ga_prefix": "020922",
				"type": 0,
				"id": 9720198
			}
		]
	},
	"Author": {
		"name": "Alone88",
		"desc": "由Alone88提供的免费API 服务,官方文档:www.alapi.cn"
	}
}
服务级错误码参照
错误码 说明
500 处理异常
完整教学代码示例
<?php

/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2020/02/01 00:16
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://v1.alapi.cn/api/tophub/get';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

const (
	APIURL   = "https://v1.alapi.cn/api/tophub/get"
)

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))
}