😮💨完善github信息获取机制,完善action文件,修复问题(@weekdaycare)
This commit is contained in:
parent
d9019fe88e
commit
ec87edc284
2
.github/workflows/deal_subscribe_issue.yml
vendored
2
.github/workflows/deal_subscribe_issue.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
|||||||
issue-number: ${{ github.event.issue.number }}
|
issue-number: ${{ github.event.issue.number }}
|
||||||
body: |
|
body: |
|
||||||
🤩你好呀! ${{ github.event.issue.user.login }}!你已经成功通过邮件订阅了本站啦!若有新文章将通过邮箱推送给你!谢谢你的订阅!
|
🤩你好呀! ${{ github.event.issue.user.login }}!你已经成功通过邮件订阅了本站啦!若有新文章将通过邮箱推送给你!谢谢你的订阅!
|
||||||
😥如果您实在想要关闭订阅,在右下角直接删除这个issue就好!咕咕咕咕咕咕咕!
|
😥如果您实在想要关闭订阅,在右下角直接删除这个issue就好!咕咕咕咕咕咕咕!感谢你的订阅!
|
||||||
|
|
||||||
- name: Close issue
|
- name: Close issue
|
||||||
uses: actions-cool/issues-helper@v3
|
uses: actions-cool/issues-helper@v3
|
||||||
|
2
.github/workflows/friend_circle_lite.yml
vendored
2
.github/workflows/friend_circle_lite.yml
vendored
@ -46,7 +46,9 @@ jobs:
|
|||||||
- name: Check RSS feeds
|
- name: Check RSS feeds
|
||||||
env:
|
env:
|
||||||
SMTP_PWD: ${{ secrets.SMTP_PWD }}
|
SMTP_PWD: ${{ secrets.SMTP_PWD }}
|
||||||
|
FCL_REPO: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
|
echo "Checking RSS feeds..."
|
||||||
python run.py
|
python run.py
|
||||||
|
|
||||||
- name: Upload last_articles.json as artifact
|
- name: Upload last_articles.json as artifact
|
||||||
|
@ -193,7 +193,7 @@ def parse_feed(url, session, count=5):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"不可链接的FEED地址:{url}: {e}")
|
print(f"不可链接的FEED地址:{url} : {e}")
|
||||||
return {
|
return {
|
||||||
'website_name': '',
|
'website_name': '',
|
||||||
'author': '',
|
'author': '',
|
||||||
@ -223,10 +223,10 @@ def process_friend(friend, session, count, specific_RSS=[]):
|
|||||||
if rss_feed:
|
if rss_feed:
|
||||||
feed_url = rss_feed
|
feed_url = rss_feed
|
||||||
feed_type = 'specific'
|
feed_type = 'specific'
|
||||||
print(f"========“{name}”的博客“{blog_url}”为特定RSS源“{feed_url}”========")
|
print(f"========“{name}”的博客“{blog_url} ”为特定RSS源“{feed_url}”========")
|
||||||
else:
|
else:
|
||||||
feed_type, feed_url = check_feed(blog_url, session)
|
feed_type, feed_url = check_feed(blog_url, session)
|
||||||
print(f"========“{name}”的博客“{blog_url}”的feed类型为“{feed_type}”========")
|
print(f"========“{name}”的博客“{blog_url} ”的feed类型为“{feed_type}”========")
|
||||||
|
|
||||||
if feed_type != 'none':
|
if feed_type != 'none':
|
||||||
feed_info = parse_feed(feed_url, session, count)
|
feed_info = parse_feed(feed_url, session, count)
|
||||||
@ -275,7 +275,7 @@ def fetch_and_process_data(json_url, specific_RSS=[], count=5):
|
|||||||
response = session.get(json_url, headers=headers, timeout=timeout)
|
response = session.get(json_url, headers=headers, timeout=timeout)
|
||||||
friends_data = response.json()
|
friends_data = response.json()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"无法获取该链接:{json_url}, 出现的问题为:{e}")
|
print(f"无法获取该链接:{json_url} , 出现的问题为:{e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
total_friends = len(friends_data['friends'])
|
total_friends = len(friends_data['friends'])
|
||||||
@ -364,7 +364,7 @@ def marge_data_from_json_url(data, marge_json_url):
|
|||||||
response = requests.get(marge_json_url, headers=headers, timeout=timeout)
|
response = requests.get(marge_json_url, headers=headers, timeout=timeout)
|
||||||
marge_data = response.json()
|
marge_data = response.json()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"无法获取该链接:{marge_json_url}, 出现的问题为:{e}")
|
print(f"无法获取该链接:{marge_json_url} , 出现的问题为:{e}")
|
||||||
return data
|
return data
|
||||||
|
|
||||||
if 'article_data' in marge_data:
|
if 'article_data' in marge_data:
|
||||||
@ -389,7 +389,7 @@ def marge_errors_from_json_url(errors, marge_json_url):
|
|||||||
response = requests.get(marge_json_url, headers=headers, timeout=timeout)
|
response = requests.get(marge_json_url, headers=headers, timeout=timeout)
|
||||||
marge_errors = response.json()
|
marge_errors = response.json()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"无法获取该链接:{marge_json_url}, 出现的问题为:{e}")
|
print(f"无法获取该链接:{marge_json_url} , 出现的问题为:{e}")
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
print("开始合并错误信息,原错误信息共有 %d 位朋友,境外错误信息共有 %d 位朋友" % (len(errors), len(marge_errors)))
|
print("开始合并错误信息,原错误信息共有 %d 位朋友,境外错误信息共有 %d 位朋友" % (len(errors), len(marge_errors)))
|
||||||
|
12
run.py
12
run.py
@ -45,8 +45,20 @@ if config["email_push"]["enable"]:
|
|||||||
if config["rss_subscribe"]["enable"]:
|
if config["rss_subscribe"]["enable"]:
|
||||||
print("RSS通过issue订阅已启用")
|
print("RSS通过issue订阅已启用")
|
||||||
# 获取并强制转换为字符串
|
# 获取并强制转换为字符串
|
||||||
|
# 尝试从环境变量获取 FCL_REPO
|
||||||
|
fcl_repo = os.getenv('FCL_REPO')
|
||||||
|
|
||||||
|
# 提取 github_username 和 github_repo
|
||||||
|
if fcl_repo:
|
||||||
|
github_username, github_repo = fcl_repo.split('/')
|
||||||
|
print(f"从环境变量获取到的 GitHub Username: {github_username}")
|
||||||
|
print(f"从环境变量获取到的 GitHub Repo: {github_repo}")
|
||||||
|
else:
|
||||||
github_username = str(config["rss_subscribe"]["github_username"]).strip()
|
github_username = str(config["rss_subscribe"]["github_username"]).strip()
|
||||||
github_repo = str(config["rss_subscribe"]["github_repo"]).strip()
|
github_repo = str(config["rss_subscribe"]["github_repo"]).strip()
|
||||||
|
print(f"从配置文件获取到的 GitHub Username: {github_username}")
|
||||||
|
print(f"从配置文件获取到的 GitHub Repo: {github_repo}")
|
||||||
|
|
||||||
your_blog_url = config["rss_subscribe"]["your_blog_url"]
|
your_blog_url = config["rss_subscribe"]["your_blog_url"]
|
||||||
email_template = config["rss_subscribe"]["email_template"]
|
email_template = config["rss_subscribe"]["email_template"]
|
||||||
# 获取网站信息
|
# 获取网站信息
|
||||||
|
Loading…
x
Reference in New Issue
Block a user