周六花了一个小时支持了 MIP 网页,今天再接再厉将历史内容全部提交到熊掌号。
首先将数据库中的所有笔记的链接导出:
SELECT CONCAT("https://www.sunzhongwei.com/mip/", slug) FROM articles
order by id desc
INTO OUTFILE '/tmp/urls.txt'
但是报错
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
查看 secure_file_priv 的目录,然后指定导出文件的目录
mysql> SELECT @@global.secure_file_priv;
+---------------------------+
| @@global.secure_file_priv |
+---------------------------+
| /var/lib/mysql-files/ |
+---------------------------+
1 row in set (0.00 sec)
mysql> SELECT CONCAT("https://www.sunzhongwei.com/mip/", slug) FROM articles order by id desc INTO OUTFILE '/var/lib/mysql-files/urls.txt';
Query OK, 658 rows affected (0.02 sec)
然后通过熊掌号的历史内容接口,curl 批量提交网址
curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?appid=<YOUR_ID>&token=<YOUR_TOKEN>&type=batch"
历史内容接口的日限额是 500 万个网址,所以不用担心会超出配额。
微信关注我哦 👍
我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式