Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

国服新闻有bug #62

Closed
kafenut opened this issue Oct 23, 2023 · 2 comments
Closed

国服新闻有bug #62

kafenut opened this issue Oct 23, 2023 · 2 comments

Comments

@kafenut
Copy link

kafenut commented Oct 23, 2023

获取新闻更新

async def news_broadcast_bili():
news_list = await sort_news()
current_dir = os.path.join(os.path.dirname(file), 'prev_time_tw.yml')
with open(current_dir, 'r', encoding="UTF-8") as f:
init_time = str(f.read())
init_time = datetime.datetime.strptime(init_time, '%Y-%m-%d %H:%M:%S')
msg = '◎◎ B服马娘新闻更新 ◎◎\n'
for news in news_list:
prev_time = datetime.datetime.strptime(news.news_time, '%Y-%m-%d %H:%M:%S')
if (init_time >= prev_time):
break
else:
news_time = datetime.datetime.strptime(news.news_time, '%Y-%m-%d %H:%M:%S')
msg += '\n' + str(news_time) + '\n' + news.news_title + '\n' + news.news_url + '\n'

for news in news_list:
    set_time = news.news_time
    break
with open(current_dir, 'w', encoding="UTF-8") as f:
    f.write(str(set_time))
return msg

这个函数write的是prev_time_tw.yml

@azmiao
Copy link
Owner

azmiao commented Oct 23, 2023

哦,复制的时候写错了23333

@azmiao azmiao closed this as completed in dd981cb Oct 23, 2023
@azmiao
Copy link
Owner

azmiao commented Oct 23, 2023

直接改了下,未测试,如果还有问题的话再反馈下我再仔细看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants