Skip to content

Commit

Permalink
修改 baidupush CI
Browse files Browse the repository at this point in the history
  • Loading branch information
beiklive committed May 16, 2024
1 parent 88aba0a commit 374c836
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@
},
"active": "b17e861e7080aef8",
"lastOpenFiles": [
"tools/百度站长推送/baiduPush.py",
"tools/百度站长推送/新建文本文档.txt",
"tools/百度站长推送",
"tools/新建文件夹",
"beiklive/02.记录/01.工具使用/01.Git.md",
"beiklive/Note_Qt/04.问题记录 QT 开机自启动读取文件失败.md",
"beiklive/Note_Godot/01.gdscript - 常用代码片段.md",
Expand All @@ -168,9 +172,6 @@
"tools/新文章生成器/build/main/PYZ-00.toc",
"tools/新文章生成器/build/main/PYZ-00.pyz",
"tools/新文章生成器/build/main/localpycs/struct.pyc",
"tools/新文章生成器/build/main/localpycs/pyimod04_pywin32.pyc",
"tools/新文章生成器/build/main/localpycs/pyimod03_ctypes.pyc",
"tools/新文章生成器/build/main/localpycs/pyimod02_importers.pyc",
"beiklive/Note_Godot/02.着色器 - 图片像素化.md",
"beiklive/Note_Godot/03.着色器学习(零)-基础简介.md",
"beiklive/Note_Godot/04.着色器学习(一)-基本语法.md",
Expand All @@ -193,7 +194,6 @@
"beiklive/02.记录/02.折腾记录/00.obsidian.md",
"beiklive/02.记录/01.工具使用/03.xmake.md",
"beiklive/02.记录/01.工具使用/02.vscode.md",
"beiklive/01.学习/03.夏姬八学/01.other.md",
"node_modules/npm/node_modules/promise-retry/node_modules/retry/equation.gif",
"node_modules/yamljs/test/lib/jasmine-2.0.0/jasmine_favicon.png",
"node_modules/stream-http/test/server/static/browserify.png",
Expand Down
2 changes: 1 addition & 1 deletion baiduPush.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
set -e

# 百度链接推送
curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?site=https://xugaoyi.com&token=T5PEAzhGaPNbjQ2X"
curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?site=doc.beiklive.top&token=wrUX2ETDK1sgdhZA"

rm -rf urls.txt # 删除文件
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prebuild": "node utils/check.js build && vdoing",
"deploy": "bash deploy.sh",
"editFm": "node utils/editFrontmatter.js",
"baiduPush": "node utils/baiduPush.js https://xugaoyi.com && bash baiduPush.sh",
"baiduPush": "node utils/baiduPush.js http://doc.beiklive.top && bash baiduPush.sh",
"publish": "cd ./vdoing && npm publish && cd .. && yarn updateTheme",
"updateTheme": "yarn remove vuepress-theme-vdoing && rm -rf node_modules && yarn && yarn add vuepress-theme-vdoing -D"
},
Expand Down
25 changes: 25 additions & 0 deletions tools/百度站长推送/baiduPush.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import argparse

def list_files(startpath, output_file):
base_url = "http://doc.beiklive.top/"
with open(output_file, 'w', encoding='utf-8') as f:
for root, dirs, files in os.walk(startpath):
for file in files:
# 获取相对于起始路径的相对路径
relative_path = os.path.relpath(os.path.join(root, file), startpath)
# 构建完整的 URL
full_url = base_url + relative_path.replace("\\", "/")
# 写入文件
f.write(full_url + '\n')

def main():
parser = argparse.ArgumentParser(description='列出指定路径下的所有文件并保存到文件中')
parser.add_argument('startpath', help='起始路径')
parser.add_argument('output_file', help='输出文件路径')
args = parser.parse_args()

list_files(args.startpath, args.output_file)

if __name__ == "__main__":
main()

0 comments on commit 374c836

Please sign in to comment.