From fd5d95e4c66bf04cfc161c8b9dc607d5a932e83e Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:16:01 +0800 Subject: [PATCH 01/14] test no arg --- .github/workflows/pushUrl.yml | 2 +- pushUrl.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index 14a05b90..d39a6a40 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -36,4 +36,4 @@ jobs: run: pip install requests - name: Push - run: python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKEN }} --bing_api_key ${{ secrets.BING_API_KEY }} \ No newline at end of file + run: python pushUrl.py --url ${{ secrets.URLs }} --baidu_token ${{ secrets.BAIDU_TOKEN }} --bing_api_key ${{ secrets.BING_API_KEY }} \ No newline at end of file diff --git a/pushUrl.py b/pushUrl.py index af01535f..edd86418 100644 --- a/pushUrl.py +++ b/pushUrl.py @@ -70,7 +70,7 @@ def push_to_baidu(site, urls, token): if __name__ == '__main__': parser = argparse.ArgumentParser(description='parse sitemap') - parser.add_argument('--url', type=str, help='The url of your website') + parser.add_argument('--url', type=str, default=None, help='The url of your website') parser.add_argument('--bing_api_key', type=str, default=None, help='your bing api key') parser.add_argument('--baidu_token', type=str, default=None, help='Your baidu push token') args = parser.parse_args() From 46e23c7784e1b64171e0f66eac7be47f36bc1d10 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:21:04 +0800 Subject: [PATCH 02/14] test no arg --- .github/workflows/pushUrl.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index d39a6a40..a2537c8a 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -36,4 +36,18 @@ jobs: run: pip install requests - name: Push - run: python pushUrl.py --url ${{ secrets.URLs }} --baidu_token ${{ secrets.BAIDU_TOKEN }} --bing_api_key ${{ secrets.BING_API_KEY }} \ No newline at end of file + run: + if [ -n "${{ secrets.URLs }}" ]; then + if [ -n "${{ secrets.BAIDU_TOKEN }}" ]; then + python pushUrl.py --url ${{ secrets.URLs }} --baidu_token ${{ secrets.BAIDU_TOKEN }} + else + echo "Secret BAIDU_TOKEN does not exist." + fi + if [ -n "${{ secrets.BING_API_KEY }}" ]; then + python pushUrl.py --url ${{ secrets.URLs }} --bing_api_key ${{ secrets.BING_API_KEY }} + else + echo "Secret BING_API_KEY does not exist." + fi + else + echo "Secret URLs does not exist." + fi From 278381592f299fac939cce4df55637698987cc13 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:23:47 +0800 Subject: [PATCH 03/14] test no arg --- .github/workflows/pushUrl.yml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index a2537c8a..5cd0b7ce 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -35,19 +35,13 @@ jobs: - name: Install requests run: pip install requests - - name: Push - run: - if [ -n "${{ secrets.URLs }}" ]; then - if [ -n "${{ secrets.BAIDU_TOKEN }}" ]; then - python pushUrl.py --url ${{ secrets.URLs }} --baidu_token ${{ secrets.BAIDU_TOKEN }} - else - echo "Secret BAIDU_TOKEN does not exist." - fi - if [ -n "${{ secrets.BING_API_KEY }}" ]; then - python pushUrl.py --url ${{ secrets.URLs }} --bing_api_key ${{ secrets.BING_API_KEY }} - else - echo "Secret BING_API_KEY does not exist." - fi + - name: Check if Secret exists + env: + URL_SECRET: ${{ secrets.URLs }} + run: | + if [ -n "$URL_SECRET" ]; then + echo "Secret URL_SECRET exists." else - echo "Secret URLs does not exist." + echo "Secret URL_SECRET does not exist." fi + From 40eb031a15fb51a6d7773e54845988423ec41fd5 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:25:17 +0800 Subject: [PATCH 04/14] test no arg --- .github/workflows/pushUrl.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index 5cd0b7ce..c1f90281 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -37,10 +37,11 @@ jobs: - name: Check if Secret exists env: - URL_SECRET: ${{ secrets.URLs }} + URL_SECRET: ${{ secrets.URL }} run: | if [ -n "$URL_SECRET" ]; then echo "Secret URL_SECRET exists." + python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKENs }} --bing_api_key ${{ secrets.BING_API_KEYs }} else echo "Secret URL_SECRET does not exist." fi From bce948730234e982cf1adf2596f60db9859a97b9 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:29:24 +0800 Subject: [PATCH 05/14] test no arg --- .github/workflows/pushUrl.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index c1f90281..19a6bf15 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -37,12 +37,19 @@ jobs: - name: Check if Secret exists env: - URL_SECRET: ${{ secrets.URL }} + URL: ${{ secrets.URLs }} + BAIDU_TOKEN: ${{ secrets.BAIDU_TOKENs }} + BING_API_KEY: ${{ secrets.BING_API_KEYs }} run: | - if [ -n "$URL_SECRET" ]; then - echo "Secret URL_SECRET exists." - python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKENs }} --bing_api_key ${{ secrets.BING_API_KEYs }} + if [ -n "$URL" ]; then + if [ -n "$BAIDU_TOKEN" ]; then + python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKENs }} + fi + if [ -n "$BAIDU_TOKEN" ]; then + python pushUrl.py --url ${{ secrets.URL }} --bing_api_key ${{ secrets.BING_API_KEYs }} + fi else - echo "Secret URL_SECRET does not exist." + echo "请前往 Github Action Secrets 配置 URL:" + echo "详情参见: https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9" fi From 20d639e98af4edd3391601ff03a7446bf07cb4b3 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:30:06 +0800 Subject: [PATCH 06/14] test no arg --- .github/workflows/pushUrl.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index 19a6bf15..945aa7c5 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -35,9 +35,9 @@ jobs: - name: Install requests run: pip install requests - - name: Check if Secret exists + - name: Push env: - URL: ${{ secrets.URLs }} + URL: ${{ secrets.URL }} BAIDU_TOKEN: ${{ secrets.BAIDU_TOKENs }} BING_API_KEY: ${{ secrets.BING_API_KEYs }} run: | @@ -50,6 +50,6 @@ jobs: fi else echo "请前往 Github Action Secrets 配置 URL:" - echo "详情参见: https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9" + echo "详情参见: 'https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" fi From 5a82f1e5831579ffa1f91f2f57ac6965298c69b0 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:31:30 +0800 Subject: [PATCH 07/14] test no arg --- .github/workflows/pushUrl.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index 945aa7c5..a4d908e4 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -44,9 +44,15 @@ jobs: if [ -n "$URL" ]; then if [ -n "$BAIDU_TOKEN" ]; then python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKENs }} + else + echo "请前往 Github Action Secrets 配置 BAIDU_TOKEN:" + echo "详情参见: 'https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" fi if [ -n "$BAIDU_TOKEN" ]; then python pushUrl.py --url ${{ secrets.URL }} --bing_api_key ${{ secrets.BING_API_KEYs }} + else + echo "请前往 Github Action Secrets 配置 BING_API_KEY:" + echo "详情参见: 'https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" fi else echo "请前往 Github Action Secrets 配置 URL:" From 28f6eb39afb9c358be280651d6c20341b36f51b1 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:32:44 +0800 Subject: [PATCH 08/14] test no arg --- .github/workflows/pushUrl.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index a4d908e4..fb366d3f 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -38,7 +38,7 @@ jobs: - name: Push env: URL: ${{ secrets.URL }} - BAIDU_TOKEN: ${{ secrets.BAIDU_TOKENs }} + BAIDU_TOKEN: ${{ secrets.BAIDU_TOKEN }} BING_API_KEY: ${{ secrets.BING_API_KEYs }} run: | if [ -n "$URL" ]; then @@ -46,16 +46,16 @@ jobs: python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKENs }} else echo "请前往 Github Action Secrets 配置 BAIDU_TOKEN:" - echo "详情参见: 'https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" + echo "详情参见: 'https://www.ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" fi if [ -n "$BAIDU_TOKEN" ]; then python pushUrl.py --url ${{ secrets.URL }} --bing_api_key ${{ secrets.BING_API_KEYs }} else echo "请前往 Github Action Secrets 配置 BING_API_KEY:" - echo "详情参见: 'https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" + echo "详情参见: 'https://www.ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" fi else echo "请前往 Github Action Secrets 配置 URL:" - echo "详情参见: 'https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" + echo "详情参见: 'https://www.ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" fi From b759f2ebe9827e99c9d807584d9f24f2fdfe7d54 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:34:33 +0800 Subject: [PATCH 09/14] test no arg --- .github/workflows/pushUrl.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index fb366d3f..c69fbca5 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -43,13 +43,13 @@ jobs: run: | if [ -n "$URL" ]; then if [ -n "$BAIDU_TOKEN" ]; then - python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKENs }} + python pushUrl.py --url $URL --baidu_token $BAIDU_TOKEN else echo "请前往 Github Action Secrets 配置 BAIDU_TOKEN:" echo "详情参见: 'https://www.ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" fi - if [ -n "$BAIDU_TOKEN" ]; then - python pushUrl.py --url ${{ secrets.URL }} --bing_api_key ${{ secrets.BING_API_KEYs }} + if [ -n "$BING_API_KEY" ]; then + python pushUrl.py --url $URL --bing_api_key $BING_API_KEY else echo "请前往 Github Action Secrets 配置 BING_API_KEY:" echo "详情参见: 'https://www.ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9'" From d288dccee63cf31e1d35f7631e462aa3526a87df Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:35:43 +0800 Subject: [PATCH 10/14] test no arg --- .github/workflows/pushUrl.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index c69fbca5..f88faa9d 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -38,8 +38,8 @@ jobs: - name: Push env: URL: ${{ secrets.URL }} - BAIDU_TOKEN: ${{ secrets.BAIDU_TOKEN }} - BING_API_KEY: ${{ secrets.BING_API_KEYs }} + BAIDU_TOKEN: ${{ secrets.BAIDU_TOKENs }} + BING_API_KEY: ${{ secrets.BING_API_KEY }} run: | if [ -n "$URL" ]; then if [ -n "$BAIDU_TOKEN" ]; then From e071c8f6c06f48c52e5b67405e2c895c7e13ec3c Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:37:35 +0800 Subject: [PATCH 11/14] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8DpushUrl?= =?UTF-8?q?=E6=9C=AA=E9=85=8D=E7=BD=AE=E7=9B=B8=E5=85=B3Secrets=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前的修复版本未考虑充分,这次从yml中进行空值判断 --- .github/workflows/pushUrl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index f88faa9d..c8a3651f 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -38,7 +38,7 @@ jobs: - name: Push env: URL: ${{ secrets.URL }} - BAIDU_TOKEN: ${{ secrets.BAIDU_TOKENs }} + BAIDU_TOKEN: ${{ secrets.BAIDU_TOKEN }} BING_API_KEY: ${{ secrets.BING_API_KEY }} run: | if [ -n "$URL" ]; then From 22308fd069e6e187abf428e5d2c6be02315bbcad Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:41:10 +0800 Subject: [PATCH 12/14] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8DpushUrl?= =?UTF-8?q?=E6=9C=AA=E9=85=8D=E7=BD=AE=E7=9B=B8=E5=85=B3Secrets=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前的修复版本未考虑充分,这次从yml中进行空值判断 --- pushUrl.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pushUrl.py b/pushUrl.py index edd86418..d67edf14 100644 --- a/pushUrl.py +++ b/pushUrl.py @@ -89,15 +89,9 @@ if __name__ == '__main__': # 推送bing if args.bing_api_key: push_to_bing(args.url, urls, args.bing_api_key) - else: - print('未配置 Bing API Key') - print('详情参见: https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9') # 推送百度 if args.baidu_token: push_to_baidu(args.url, urls, args.baidu_token) - else: - print('未配置 Baidu Token') - print('详情参见: https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9') else: print('请前往 Github Action Secrets 配置 URL') print('详情参见: https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9') From 21f92b5491c93a72ea3e3730c5c1335bbbcc6b94 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:42:20 +0800 Subject: [PATCH 13/14] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8DpushUrl?= =?UTF-8?q?=E6=9C=AA=E9=85=8D=E7=BD=AE=E7=9B=B8=E5=85=B3Secrets=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前的修复版本未考虑充分,这次从yml中进行空值判断 --- pushUrl.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pushUrl.py b/pushUrl.py index d67edf14..fe5a1bfe 100644 --- a/pushUrl.py +++ b/pushUrl.py @@ -19,8 +19,6 @@ def parse_stiemap(site): try: result = requests.get(site) big = re.findall('(.*?)', result.content.decode('utf-8'), re.S) - print('当前已有url:') - print(list(big)) return list(big) except: print('请检查你的url是否有误。') From 9aea913c3ab49a2d6421d9efb087a0a0c185cb4a Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Sat, 2 Sep 2023 15:43:54 +0800 Subject: [PATCH 14/14] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8DpushUrl?= =?UTF-8?q?=E6=9C=AA=E9=85=8D=E7=BD=AE=E7=9B=B8=E5=85=B3Secrets=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前的修复版本未考虑充分,这次从yml中进行空值判断 --- pushUrl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pushUrl.py b/pushUrl.py index fe5a1bfe..a1ac7844 100644 --- a/pushUrl.py +++ b/pushUrl.py @@ -15,7 +15,6 @@ QUOTA = 100 def parse_stiemap(site): site = f'{site}/sitemap.xml' - print('解析站点地图中,请稍后……') try: result = requests.get(site) big = re.findall('(.*?)', result.content.decode('utf-8'), re.S) @@ -86,9 +85,11 @@ if __name__ == '__main__': urls = random.sample(urls, QUOTA) # 推送bing if args.bing_api_key: + print('正在推送至必应,请稍后……') push_to_bing(args.url, urls, args.bing_api_key) # 推送百度 if args.baidu_token: + print('正在推送至百度,请稍后……') push_to_baidu(args.url, urls, args.baidu_token) else: print('请前往 Github Action Secrets 配置 URL')