From b40b8af2018daa3bf51a87498ecee6adb553124c Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Mon, 7 Aug 2023 15:12:49 +0800 Subject: [PATCH] test api push --- .github/workflows/baidupush.yml | 4 ++-- baidupush.py | 6 +++--- baidupush.sh | 10 ++-------- package.json | 2 +- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/baidupush.yml b/.github/workflows/baidupush.yml index 322a6166..08e3c048 100644 --- a/.github/workflows/baidupush.yml +++ b/.github/workflows/baidupush.yml @@ -9,8 +9,8 @@ on: # - cron: '0 23 * * *' # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule # on: - schedule: - - cron: '*/5 * * * *' # 每5分钟一次,测试用 + # schedule: + # - cron: '*/5 * * * *' # 每5分钟一次,测试用 jobs: bot: diff --git a/baidupush.py b/baidupush.py index c03217b7..63c82ed7 100644 --- a/baidupush.py +++ b/baidupush.py @@ -13,6 +13,6 @@ if __name__ == '__main__': result = requests.get(url) big = re.findall('(.*?)', result.content.decode('utf-8'), re.S) for i in big: - print(i) - # op_xml_txt = open('xml.txt', 'a') - # op_xml_txt.write('%s\n' % i) + # print(i) + op_xml_txt = open('xml.txt', 'a') + op_xml_txt.write('%s\n' % i) diff --git a/baidupush.sh b/baidupush.sh index b9a88748..debdf0c7 100644 --- a/baidupush.sh +++ b/baidupush.sh @@ -3,14 +3,8 @@ # 确保脚本抛出遇到的错误 set -e -# 检查是否传入了正确的参数 -if [ $# -lt 1 ]; then - echo "Please provide the your website as an argument." - exit 1 -fi - # 百度链接推送 -python baidupush.py $1 -# curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?site=https://vuepress.ghlerrix.cn&token=oUldnU4HZvSTlh0e" +python baidupush.py 'www.ghlerrix.cn' +curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?site=https://www.ghlerrix.cn&token=oUldnU4HZvSTlh0e" rm -rf urls.txt # 删除文件 \ No newline at end of file diff --git a/package.json b/package.json index 2424dfac..7eabbfba 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "post-build": "next-sitemap --config next-sitemap.config.js", "export": "next build && next-sitemap --config next-sitemap.config.js && next export", "bundle-report": "ANALYZE=true yarn build", - "baidupush": "bash baidupush.sh 'www.ghlerrix.cn'" + "baidupush": "bash baidupush.sh" }, "dependencies": { "@giscus/react": "^2.2.6",