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
|
||||
loaded = []
|
||||
uploads = []
|
||||
for entry in rss.load_content():
|
||||
loaded.append(entry['id'])
|
||||
uploads.append({
|
||||
'q': entry['title'],
|
||||
'a': entry['content']
|
||||
})
|
||||
count += 1
|
||||
if len(loaded) >= 100 and upload2fastgpt(uploads):
|
||||
while entries := rss.load_content():
|
||||
for entry in entries:
|
||||
loaded.append(entry['id'])
|
||||
uploads.append({
|
||||
'q': entry['title'],
|
||||
'a': entry['content']
|
||||
})
|
||||
count += 1
|
||||
if len(loaded) >= 100 and upload2fastgpt(uploads):
|
||||
rss.update(loaded)
|
||||
loaded = []
|
||||
uploads = []
|
||||
if len(loaded) > 0 and upload2fastgpt(uploads):
|
||||
rss.update(loaded)
|
||||
loaded = []
|
||||
uploads = []
|
||||
if len(loaded) > 0 and upload2fastgpt(uploads):
|
||||
rss.update(loaded)
|
||||
print(f"Total entries loaded: {count}")
|
||||
return f"Total entries loaded: {count}"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user