Background#
Recently, I have been interested in playing QQ robots and often use third-party APIs to access data, combined with the oicq protocol library to implement simple but meaningful functions, having fun with friends in the group.
A representative example is "60-Second Understanding of the World". It provides about ten short hot news every day. Although the function is simple, the content is meaningful, especially for kids like us who never read the news.
Why do it ourselves#
Unfortunately, many website APIs are not stable, sometimes they are down or even shut down directly. So I Googled around and found that the data source of most interfaces points to this 60-Second Understanding of the World column on Zhihu.
How to do it#
After some fierce operations (in fact, it's just a simple ), I found its column data interface:JSON
GET request, without any encryption, cross-origin, request header restrictions, etc. Just press F12
and the interface will appear
https://www.zhihu.com/api/v4/columns/c_1261258401923026944/items
Optional parameters for this API URL:
limit
Number of data to returnoffset
Pagination parameter
After obtaining the data, in order to quickly create a high-performance, low-latency API with caching, I chose deno
and deployed it using Deno Deploy
. I also set it to only return the data for the current day for each request. In addition, I set up request caching, which means that Zhihu will only receive one request per day. From the second request onwards, the cache will be used directly, speeding up the API response and reducing the load on Zhihu's servers.
How to use this thing#
Here is a deployed API address that you can use directly~
Source code can be found on vikiboss/60s - GitHub. Feel free to deploy it yourself or star it~