mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-29 15:10:06 +00:00
add args
This commit is contained in:
2
.github/workflows/baidupush.yml
vendored
2
.github/workflows/baidupush.yml
vendored
@@ -29,4 +29,4 @@ jobs:
|
|||||||
run: pip install requests
|
run: pip install requests
|
||||||
|
|
||||||
- name: parse sitemap
|
- name: parse sitemap
|
||||||
run: python baidupush.py
|
run: npm run baidupush
|
||||||
23
baidupush.py
23
baidupush.py
@@ -1,11 +1,18 @@
|
|||||||
import re
|
import re
|
||||||
import ssl
|
import ssl
|
||||||
import requests
|
import requests
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context
|
import argparse
|
||||||
url = 'https://www.ghlerrix.cn/sitemap.xml'
|
|
||||||
result = requests.get(url)
|
|
||||||
big = re.findall('<loc>(.*?)</loc>', result.content.decode('utf-8'), re.S)
|
if __name__ == '__main__':
|
||||||
for i in big:
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
print(i)
|
parser = argparse.ArgumentParser(description='parse sitemap')
|
||||||
# op_xml_txt = open('xml.txt', 'a')
|
parser.add_argument('url', help='The url of your website')
|
||||||
# op_xml_txt.write('%s\n' % i)
|
args = parser.parse_args()
|
||||||
|
url = f'{args.url}/sitemap.xml'
|
||||||
|
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)
|
||||||
|
|||||||
16
baidupush.sh
Normal file
16
baidupush.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# 确保脚本抛出遇到的错误
|
||||||
|
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"
|
||||||
|
|
||||||
|
rm -rf urls.txt # 删除文件
|
||||||
@@ -18,7 +18,8 @@
|
|||||||
"start": "next start",
|
"start": "next start",
|
||||||
"post-build": "next-sitemap --config next-sitemap.config.js",
|
"post-build": "next-sitemap --config next-sitemap.config.js",
|
||||||
"export": "next build && next-sitemap --config next-sitemap.config.js && next export",
|
"export": "next build && next-sitemap --config next-sitemap.config.js && next export",
|
||||||
"bundle-report": "ANALYZE=true yarn build"
|
"bundle-report": "ANALYZE=true yarn build",
|
||||||
|
"baidupush": "bash baiduPush.sh 'www.ghlerrix.cn'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@giscus/react": "^2.2.6",
|
"@giscus/react": "^2.2.6",
|
||||||
|
|||||||
Reference in New Issue
Block a user