<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>NotionNext BLOG</title>
        <link>https://blog.to2.top/</link>
        <description>这是一个由NotionNext生成的站点</description>
        <lastBuildDate>Sat, 05 Aug 2023 15:55:04 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2023, ingm23</copyright>
        <item>
            <title><![CDATA[每天 60 秒读懂世界 API]]></title>
            <link>https://blog.to2.top/article/4</link>
            <guid>https://blog.to2.top/article/4</guid>
            <pubDate>Fri, 02 Jul 2021 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="container" class="mx-auto undefined"><main class="notion light-mode notion-page notion-block-5a34eb8e2252401d8a6b58332fde23e7"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-f7d3b1b95dbb400aac5f97289445955b" data-id="f7d3b1b95dbb400aac5f97289445955b"><span><div id="f7d3b1b95dbb400aac5f97289445955b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f7d3b1b95dbb400aac5f97289445955b" title="每天 60 秒读懂世界 API"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">每天 60 秒读懂世界 API</span></span></h2><div class="notion-text notion-block-88938d5bcd344875a4df13487a2144f3">前阵子挺热衷玩 QQ 机器人，经常会找一些第三方的 API 对接数据，实现简单功能，<s>乐呵乐呵群友</s>。</div><div class="notion-text notion-block-db3174edb80f47c38551f058bc7218cd">一个比较有代表性的例子，就是 “每天 60 秒读懂世界”。</div><div class="notion-text notion-block-9076434522cb4a12bbaae0e5402202ff">十来条简短的每日新闻和一条人生微语，功能虽简单，但内容却挺有意义，质量也还不错，<s>特别是对于我们这种从来不看新闻的来说</s>。</div><div class="notion-text notion-block-b888845f9510469f892b634adbce913d">但是奈何很多的网站的 API 服务大都不稳定，间接性的挂<s>或者直接跑路</s>，于是我就去 Google 了一圈，最后发现绝大多数的接口数据来源都指向这个<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.zhihu.com/column/c_1261258401923026944">每天 60 秒读懂世界</a>的知乎专栏。</div><div class="notion-text notion-block-f9f0b684ce7a42d0bb49712872c80ca2">于是，一顿操作下来（<s>说白了就一个简单的 </s><s><code class="notion-inline-code"><b>JSON</b></code></s><s> 请求，也没有任何加密、跨域、请求头限制等，一按 </s><s><code class="notion-inline-code"><b>F12</b></code></s><s> 就出来了</s>），找到了他的专栏数据接口：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-plain text">https://www.zhihu.com/api/v4/columns/c_1261258401923026944/items
</code></pre><hr class="notion-hr notion-block-6c7535b0f8df40f3aa48ce048740f3bf"/><div class="notion-text notion-block-adc43815016b4cd09d31cb968a8e3369">URL 可选参数：</div><ul class="notion-list notion-list-disc notion-block-d6d983f91aa849b8b3b524af7bbc2cff"><li><code class="notion-inline-code"><b>limit</b></code> 返回的数据条数</li></ul><ul class="notion-list notion-list-disc notion-block-515ae901d47f485b93803c9cd1c5bcfc"><li><code class="notion-inline-code"><b>offset</b></code> 分页参数</li></ul><div class="notion-text notion-block-2ab5bd50cce94c6581f96f821d6b3649">搞到了数据之后，为了快速创建一个高性能、低延迟同时具备缓存的 API，我选择了 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://deno.land/"><code class="notion-inline-code"><b>deno</b></code></a>，并使用 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://deno.dev/"><code class="notion-inline-code"><b>Deno Deploy</b></code></a> 进行部署。</div><div class="notion-text notion-block-d2dc8848e8f748b78c8699670089415d">这里设置了每次请求只返回我们需要的当天的一条数据。此外，还设置了缓存，也就是说，每天只会向知乎发送唯一一次请求，从第二次开始，直接使用缓存，加快了 API 响应速度的同时，还减缓知乎服务器的压力。</div><div class="notion-text notion-block-818d7f73d7de4d8c8608d035084fbb09">成品 API 地址（可以直接拿去用哦～）：</div><ul class="notion-list notion-list-disc notion-block-ea2b096616a54044853c6bb8cf4ae59f"><li>JSON：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://60s.to2.top/">https://60s.to2.top/</a></li></ul><ul class="notion-list notion-list-disc notion-block-a0c5369f464440b7a2da7786dbb0641c"><li>Text：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://60s.to2.top/?encoding=text">https://60s.to2.top/?encoding=text</a></li></ul><div class="notion-text notion-block-d615df75e0764de184e58369abd7745e">API 源码：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/ingm23/60s">60s - GitHub</a>，欢迎 star。</div><div class="notion-text notion-block-07e640657e70450c9d4d9572643ebe26">The End. Thanks for your reading.</div><div class="notion-blank notion-block-40e28f6db9904423a1183fb0fe414b35"> </div><div class="notion-blank notion-block-2871ee84882b40c38ab890ceac31d55e"> </div><div class="notion-text notion-block-79661fc0a6044210a5f34dbac7a91720">来源：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://blog.viki.moe/60s/">每天 60 秒读懂世界 API - Viki 写东西的地方</a></div><div class="notion-blank notion-block-5f22beec39d04c1eae0296ceced67b15"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[本地ping域名api源码]]></title>
            <link>https://blog.to2.top/article/3</link>
            <guid>https://blog.to2.top/article/3</guid>
            <pubDate>Fri, 31 Mar 2023 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="container" class="mx-auto undefined"><main class="notion light-mode notion-page notion-block-2700c30f36a84e31a52d0e26ff0304fe"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-61f2fb2610c948eea549ddbe33493190" data-id="61f2fb2610c948eea549ddbe33493190"><span><div id="61f2fb2610c948eea549ddbe33493190" class="notion-header-anchor"></div><a class="notion-hash-link" href="#61f2fb2610c948eea549ddbe33493190" title="pingAPI请求方式"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">pingAPI请求方式</span></span></h2><div class="notion-text notion-block-c49d515519d143088afba4b715f4d3f1">Method: GET</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-8d6d54648ca445818315c45515f42a4d" data-id="8d6d54648ca445818315c45515f42a4d"><span><div id="8d6d54648ca445818315c45515f42a4d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8d6d54648ca445818315c45515f42a4d" title="请求地址"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">请求地址</span></span></h2><div class="notion-text notion-block-4f0d0f79a5b64a4eabedcd4406cd1e3e"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.x.com/%E6%BA%90%E7%A0%81%E5%90%8D%E7%A7%B0.php?url=">https://www.x.com/源码名称.php?url=</a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-50fdc64cd1ad4190a4c8a6a899341c28" data-id="50fdc64cd1ad4190a4c8a6a899341c28"><span><div id="50fdc64cd1ad4190a4c8a6a899341c28" class="notion-header-anchor"></div><a class="notion-hash-link" href="#50fdc64cd1ad4190a4c8a6a899341c28" title="参数"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">参数</span></span></h2><div class="notion-text notion-block-6c0727e93b254255a4c641fbed8fdf8d">url＝要ping的域名</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1e8d131124484952884969ef8045ae91" data-id="1e8d131124484952884969ef8045ae91"><span><div id="1e8d131124484952884969ef8045ae91" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1e8d131124484952884969ef8045ae91" title="调用示例"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">调用示例</span></span></h2><div class="notion-text notion-block-52944ef8183c42849e6f0fda519e0d2a"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.x.com/pingapi.php?url=www.baidu.com">https://www.x.com/pingapi.php?url=www.baidu.com</a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-dd9811145d1741b78fae341af7476fdf" data-id="dd9811145d1741b78fae341af7476fdf"><span><div id="dd9811145d1741b78fae341af7476fdf" class="notion-header-anchor"></div><a class="notion-hash-link" href="#dd9811145d1741b78fae341af7476fdf" title="源码"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">源码</span></span></h2><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-plain text">&lt;?php
$url = $_GET[&#x27;url&#x27;];
$port = &#x27;80&#x27;;
$num = 1; //Ping次数
function mt_f (){
list($usec,$sec) = explode(&quot; &quot;,microtime());
return ((float)$usec + (float)$sec);
}
function ping_f($url,$port){
$time_s = mt_f();
$ip = gethostbyname($url);
$fp = @fsockopen($url,$port);
if(!$fp)
return &#x27;回复超时！&#x27;;
$get = &quot;GET / HTTP/1.1||Host:&quot;.$url.&quot;||Connect:&quot;.$port.&quot;Close||&quot;;
fputs($fp,$get);
fclose($fp);
$time_e = mt_f();
$time = $time_e - $time_s;
$time = ceil($time * 1000);
return &#x27;时间 = &#x27;.$time.&#x27;ms&#x27;;
}
for($i = 0;$i &lt; $num;$i++){
echo &#x27;正在PING: &#x27;.$url.&#x27;
来自 &#x27;.gethostbyname($url).&#x27; 的回复
&#x27;.ping_f($url,$port).&#x27;&lt;/br&gt;&#x27;;
sleep(0.1);//每次运行中间间隔0.1s
ob_flush();
flush();
}
?&gt;
</code></pre><div class="notion-blank notion-block-d122e57e6413447098f06c7b83738609"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[新闻早报]]></title>
            <link>https://blog.to2.top/article/2</link>
            <guid>https://blog.to2.top/article/2</guid>
            <pubDate>Fri, 31 Mar 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[新闻早报 每天60s新闻]]></description>
            <content:encoded><![CDATA[<div id="container" class="mx-auto undefined"><main class="notion light-mode notion-page notion-block-597ab321851e4c2eadeef5f392ec1535"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-e3b580750f414a37830df9c09560968c" data-id="e3b580750f414a37830df9c09560968c"><span><div id="e3b580750f414a37830df9c09560968c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#e3b580750f414a37830df9c09560968c" title="新闻早报 每天60s新闻"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b><b>新闻早报 每天60s新闻</b></b></span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-embed notion-block-7f875c5d896e4fd0b764e99e60a4fb2b"><div style="position:relative;display:flex;justify-content:center;align-self:end;width:100%;max-width:100%;flex-direction:column;height:930px"><iframe class="notion-asset-object-fit" src="https://api.xuemy.cn/api/60s/" title="iframe embed" frameBorder="0" allowfullscreen="" loading="lazy" scrolling="auto"></iframe></div></figure></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[hello world]]></title>
            <link>https://blog.to2.top/article/1</link>
            <guid>https://blog.to2.top/article/1</guid>
            <pubDate>Thu, 30 Mar 2023 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="container" class="mx-auto undefined"><main class="notion light-mode notion-page notion-block-e1d14cda9d8640f98729fbbacf332de2"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-cdb11d4cfb7a4817a936272209bc92c8">Hello World</div><div class="notion-blank notion-block-206d4bb0945e4030af4c5b104aa5a3f0"> </div><div class="notion-blank notion-block-79db52d01838424b9d82311bfd2a8896"> </div><div class="notion-blank notion-block-e3d5ab1cf1084589bd8c2f4531d9230b"> </div><div class="notion-blank notion-block-014517b8974d4639ad5bdb7b76add29b"> </div><div class="notion-blank notion-block-4c9f84c28b134425a9c58f1c5605f7e0"> </div><div class="notion-blank notion-block-356bc2b3e47e49cf99a98123ac394e4f"> </div><div class="notion-blank notion-block-38116cf6c49c4a84a401be1cf5baa25a"> </div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>