示例#1
0
 async def get_highlights(
     self,
     identifier: int | str = "",
     refresh: bool = True,
     limit: int = 100,
     offset: int = 0,
     hightlight_id: int | str = "",
 ) -> Union[list[create_highlight], list[create_story]]:
     result, status = await api_helper.default_data(self, refresh)
     if status:
         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.get_session_manager().json_request(link)
         results = await api_helper.remove_errors(results)
         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.get_session_manager().json_request(link)
         results = [create_story(x) for x in results["stories"]]
     return results
示例#2
0
 async def get_archived_stories(
     self, refresh: bool = True, limit: int = 100, offset: int = 0
 ):
     result, status = await api_helper.default_data(self, refresh)
     if status:
         return result
     link = endpoint_links(global_limit=limit, global_offset=offset).archived_stories
     results = await self.get_session_manager().json_request(link)
     results = await api_helper.remove_errors(results)
     results = [create_story(x) for x in results]
     return results
示例#3
0
 async def get_stories(self,
                       refresh: bool = True,
                       limit: int = 100,
                       offset: int = 0) -> list[create_story]:
     result, status = await api_helper.default_data(self, refresh)
     if status:
         return result
     link = [
         endpoint_links(identifier=self.id,
                        global_limit=limit,
                        global_offset=offset).stories_api
     ]
     results = await api_helper.scrape_endpoint_links(
         link, self.get_session_manager())
     results = [create_story(x) for x in results]
     self.temp_scraped.Stories = results
     return results