feed_uris: List[str],
page_title: str,
):
- super().__init__(
- name_to_timeout_dict, feed_site, feed_uris, page_title
- )
+ super().__init__(name_to_timeout_dict, feed_site, feed_uris, page_title)
def get_headlines_page_prefix(self) -> str:
return f"cnn-{self.page_title}"
def get_details_page_prefix(self) -> str:
return f"cnn-details-{self.page_title}"
- def munge_description(self, description: str, item: xml.etree.ElementTree.Element) -> str:
+ def munge_description(
+ self, description: str, item: xml.etree.ElementTree.Element
+ ) -> str:
description = re.sub("[Rr]ead full story for latest details.", "", description)
description = re.sub("<[^>]+>", "", description)
return description
def item_is_interesting_for_headlines(
self, title: str, description: str, item: xml.etree.ElementTree.Element
) -> bool:
- if self.is_item_older_than_n_days(item, 14):
+ if self.is_item_older_than_n_days(item, 14, default=False):
return False
return re.search(r"[Cc][Nn][Nn][A-Za-z]*\.com", title) is None
def do_details(self) -> bool:
return True
- def is_item_older_than_n_days(self, item: ET.Element, n: int) -> bool:
+ def is_item_older_than_n_days(
+ self, item: ET.Element, n: int, default: bool = False
+ ) -> bool:
pubdate = self.find_pubdate(item)
if pubdate is None:
- return False
+ return default
pubdatetime = parse(pubdate)
tzinfo = pubdatetime.tzinfo
now = datetime.datetime.now(tzinfo)