forked from tangly1024/NotionNext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,4 @@ jobs: | |
run: pip install requests | ||
|
||
- name: parse sitemap | ||
run: python baidupush.py | ||
run: npm run baidupush |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
import re | ||
import ssl | ||
import requests | ||
ssl._create_default_https_context = ssl._create_unverified_context | ||
url = 'https://www.ghlerrix.cn/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) | ||
import argparse | ||
|
||
|
||
if __name__ == '__main__': | ||
ssl._create_default_https_context = ssl._create_unverified_context | ||
parser = argparse.ArgumentParser(description='parse sitemap') | ||
parser.add_argument('url', help='The url of your website') | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 # 删除文件 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters