@@ -163,7 +163,7 @@ def __get_stream_contents(self, stream_id, continuation=''):
163163 else :
164164 return response ['items' ], None
165165
166- def fetch_unread (self , folder = None , tags = None ):
166+ def fetch_articles (self , folder = None , tags = None , unread = True , starred = False ):
167167 self .check_token ()
168168
169169 url = urljoin (BASE_URL , self .STREAM_CONTENTS_PATH )
@@ -172,7 +172,13 @@ def fetch_unread(self, folder=None, tags=None):
172172 url ,
173173 quote_plus (self .GENERAL_TAG_TEMPLATE .format (folder ))
174174 )
175- params = {'xt' : self .READ_TAG , 'c' : str (uuid4 ())}
175+
176+ params = {'c' : str (uuid4 ())}
177+ if unread :
178+ params ['xt' ] = self .READ_TAG
179+
180+ if starred :
181+ params ['it' ] = self .STARRED_TAG
176182
177183 response = self .parse_response (self .session .post (url , params = params , proxies = self .proxies ))
178184 for data in response ['items' ]:
@@ -182,6 +188,7 @@ def fetch_unread(self, folder=None, tags=None):
182188 ])
183189 if tags and not categories .issuperset (set (tags )):
184190 continue
191+
185192 yield Article .from_json (data )
186193
187194 continuation = response .get ('continuation' )
@@ -198,8 +205,13 @@ def fetch_unread(self, folder=None, tags=None):
198205 if tags and not categories .issuperset (set (tags )):
199206 continue
200207 yield Article .from_json (data )
208+
201209 continuation = response .get ('continuation' )
202210
211+ def fetch_unread (self , folder = None , tags = None ):
212+ for article in self .fetch_articles (folder = folder , tags = tags , unread = True ):
213+ yield article
214+
203215 def add_general_label (self , articles , label ):
204216 self .check_token ()
205217
0 commit comments