improved rss subscribe
This commit is contained in:
parent
0f28e11323
commit
3f6c5547cb
25
main.py
25
main.py
@ -39,19 +39,20 @@ async def load_rss():
|
|||||||
count = 0
|
count = 0
|
||||||
loaded = []
|
loaded = []
|
||||||
uploads = []
|
uploads = []
|
||||||
for entry in rss.load_content():
|
while entries := rss.load_content():
|
||||||
loaded.append(entry['id'])
|
for entry in entries:
|
||||||
uploads.append({
|
loaded.append(entry['id'])
|
||||||
'q': entry['title'],
|
uploads.append({
|
||||||
'a': entry['content']
|
'q': entry['title'],
|
||||||
})
|
'a': entry['content']
|
||||||
count += 1
|
})
|
||||||
if len(loaded) >= 100 and upload2fastgpt(uploads):
|
count += 1
|
||||||
|
if len(loaded) >= 100 and upload2fastgpt(uploads):
|
||||||
|
rss.update(loaded)
|
||||||
|
loaded = []
|
||||||
|
uploads = []
|
||||||
|
if len(loaded) > 0 and upload2fastgpt(uploads):
|
||||||
rss.update(loaded)
|
rss.update(loaded)
|
||||||
loaded = []
|
|
||||||
uploads = []
|
|
||||||
if len(loaded) > 0 and upload2fastgpt(uploads):
|
|
||||||
rss.update(loaded)
|
|
||||||
print(f"Total entries loaded: {count}")
|
print(f"Total entries loaded: {count}")
|
||||||
return f"Total entries loaded: {count}"
|
return f"Total entries loaded: {count}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user