Created
April 12, 2022 23:21
-
-
Save TennousuAthena/ae635206c8b1afdaf65ad1a1ef745276 to your computer and use it in GitHub Desktop.
从hotokoto自动同步诗词到p.txt
This file contains hidden or 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
#!/usr/bin/python3 | |
import requests, os, time | |
while True: | |
url = "https://v1.hitokoto.cn/?c=i" | |
response = requests.get(url).json() | |
file = open('p.txt','w',encoding='utf-8') | |
file.write(response['hitokoto']+"\n"+response['from_who']+" 《"+response['from']+"》") | |
file.close() | |
print(response) | |
time.sleep(30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment