你知道吗

This commit is contained in:
tsxc 2025-02-06 12:33:07 +08:00
parent 8277662f20
commit 0ba9eeb6a1
4 changed files with 22 additions and 2 deletions

5
Tips.yaml Normal file
View File

@ -0,0 +1,5 @@
"Tips":
- "你知道吗:加载器的发行代号其实是绵中的各个楼以正大门为原点从近到远排的"
- "热知识boen的饼一般会在三年内完成"
- "热知识boen负责画饼烙饼负责烙……"
- "😨知识:烙饼说他想让全服的人只能用加载器进服"

View File

@ -1,3 +1,4 @@
<local:MyHint Margin="0,8,0,2" IsWarn="False" Text="$你知道吗$" />
<local:MyCard Margin="0,10,0,14">
<Border BorderBrush="{DynamicResource ColorBrush2}" Margin="-0.6" CornerRadius="5" BorderThickness="0,0,0,10">
<StackPanel>
@ -26,4 +27,4 @@
</Grid>
</StackPanel>
</Border>
</local:MyCard>
</local:MyCard>

View File

@ -1,4 +1,5 @@
datetime
requests
markdownify
python-dateutil
python-dateutil
pyyaml

View File

@ -4,6 +4,8 @@ import xml.etree.ElementTree as ET
from dateutil.parser import parse
from markdownify import markdownify as md
import os
import random
import yaml
response = requests.get("https://mc.boen.fun/feed",verify=False)
# os.open("feed.xml",os.O_CREAT)
@ -68,7 +70,18 @@ for child in root:
os.system("mkdir public")
os.system("builder build --output-path public/output.xaml")
# 将卡片设置为折叠
with open("public/output.xaml","r",encoding='UTF-8') as f:
Text=f.read().replace("IsSwaped=\"False\"","IsSwaped=\"True\"")
with open("public/output.xaml","w",encoding='UTF-8') as f:
f.write(Text)
# 随机添加一条你知道吗
with open("Tips.yaml","r",encoding='UTF-8') as f:
Tips=yaml.load(f.read(),Loader=yaml.FullLoader)["Tips"]
Tip=Tips[random.SystemRandom().randint(0,len(Tips)-1)]
with open("public/output.xaml","r",encoding='UTF-8') as f:
Text=f.read().replace("$你知道吗$",Tip)
with open("public/output.xaml","w",encoding='UTF-8') as f:
f.write(Text)