mirror of
https://codeberg.org/Reuh/feather.git
synced 2025-10-27 18:19: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
|
return l
|
||||||
|
|
||||||
def get_articles_in_category(self, category: Category, limit: int = 1000, continuation: int = 0, unread_only: bool = False) -> list[GReaderArticle]:
|
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(
|
item_ids = [
|
||||||
self.auth_token,
|
item.id
|
||||||
stream_id=category.id,
|
for item in self.greader.get_stream_items_ids(
|
||||||
exclude_target="user/-/state/com.google/read" if unread_only else None,
|
self.auth_token,
|
||||||
limit=limit,
|
stream_id=category.id,
|
||||||
continuation=continuation,
|
exclude_target="user/-/state/com.google/read" if unread_only else None,
|
||||||
)
|
limit=limit,
|
||||||
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])
|
continuation=continuation,
|
||||||
return [ GReaderArticle(self, category, item_content) for item_content in item_contents.items ]
|
).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):
|
class GReaderArticle(Article):
|
||||||
def __init__(self, session: GReaderSession, category: Category, item_content):
|
def __init__(self, session: GReaderSession, category: Category, item_content):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue