mirror of
https://codeberg.org/Reuh/feather.git
synced 2025-10-27 10:09:32 +00:00
fix: googlereader error when a category is empty
This commit is contained in:
parent
a63f71f711
commit
5635b0acd6
1 changed files with 15 additions and 9 deletions
|
|
@ -54,15 +54,21 @@ class GReaderSession(ClientSession):
|
|||
return l
|
||||
|
||||
def get_articles_in_category(self, category: Category, limit: int = 1000, continuation: int = 0, unread_only: bool = False) -> list[GReaderArticle]:
|
||||
items_ids = self.greader.get_stream_items_ids(
|
||||
self.auth_token,
|
||||
stream_id=category.id,
|
||||
exclude_target="user/-/state/com.google/read" if unread_only else None,
|
||||
limit=limit,
|
||||
continuation=continuation,
|
||||
)
|
||||
item_contents = self.greader.get_stream_items_contents(self.auth_token, self.csrf_token, item_ids=[item.id for item in items_ids.item_refs])
|
||||
return [ GReaderArticle(self, category, item_content) for item_content in item_contents.items ]
|
||||
item_ids = [
|
||||
item.id
|
||||
for item in self.greader.get_stream_items_ids(
|
||||
self.auth_token,
|
||||
stream_id=category.id,
|
||||
exclude_target="user/-/state/com.google/read" if unread_only else None,
|
||||
limit=limit,
|
||||
continuation=continuation,
|
||||
).item_refs
|
||||
]
|
||||
if len(item_ids) == 0:
|
||||
return []
|
||||
else:
|
||||
item_contents = self.greader.get_stream_items_contents(self.auth_token, self.csrf_token, item_ids=item_ids)
|
||||
return [ GReaderArticle(self, category, item_content) for item_content in item_contents.items ]
|
||||
|
||||
class GReaderArticle(Article):
|
||||
def __init__(self, session: GReaderSession, category: Category, item_content):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue