Beispiel #1
0
 async def get_highlights(self,
                          identifier="",
                          refresh=True,
                          limit=100,
                          offset=0,
                          hightlight_id="") -> list:
     api_type = "highlights"
     if not refresh:
         result = handle_refresh(self, api_type)
         if result:
             return result
     if not identifier:
         identifier = self.id
     if not hightlight_id:
         link = endpoint_links(identifier=identifier,
                               global_limit=limit,
                               global_offset=offset).list_highlights
         results = await self.session_manager.json_request(link)
         results = [create_highlight(x) for x in results]
     else:
         link = endpoint_links(identifier=hightlight_id,
                               global_limit=limit,
                               global_offset=offset).highlight
         results = await self.session_manager.json_request(link)
         results = [create_story(x) for x in results["stories"]]
     return results
Beispiel #2
0
 async def get_archived_stories(self, refresh=True, limit=100, offset=0):
     api_type = "archived_stories"
     if not refresh:
         result = handle_refresh(self, api_type)
         if result:
             return result
     link = endpoint_links(global_limit=limit, global_offset=offset).archived_stories
     results = await self.session_manager.json_request(link)
     results = await remove_errors(results)
     results = [create_story(x) for x in results]
     return results
Beispiel #3
0
 async def get_stories(self, refresh=True, limit=100, offset=0) -> list:
     api_type = "stories"
     if not refresh:
         result = handle_refresh(self, api_type)
         if result:
             return result
     if not self.hasStories:
         return []
     link = [
         endpoint_links(identifier=self.id,
                        global_limit=limit,
                        global_offset=offset).stories_api
     ]
     results = await api_helper.scrape_endpoint_links(
         link, self.session_manager, api_type)
     results = [create_story(x) for x in results]
     self.temp_scraped.Stories = results
     return results