Skip to content

Commit

Permalink
test api push
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghlerrix committed Aug 7, 2023
1 parent ffcec4f commit b40b8af
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/baidupush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions baidupush.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
result = requests.get(url)
big = re.findall('<loc>(.*?)</loc>', 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)
10 changes: 2 additions & 8 deletions baidupush.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 # 删除文件
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b40b8af

Please sign in to comment.