5 from typing import Dict, List, Optional
8 from dateutil.parser import parse
10 import generic_news_rss_renderer as gnrss
13 # https://www.theurbanist.org/feed/
14 class urbanist_renderer(gnrss.generic_news_rss_renderer):
15 """Read the TheUrbanist feed."""
19 name_to_timeout_dict: Dict[str, int],
24 super(urbanist_renderer, self).__init__(
25 name_to_timeout_dict, feed_site, feed_uris, page_title
29 def debug_prefix(self) -> str:
30 return f"urbanist({self.page_title})"
32 def get_headlines_page_prefix(self) -> str:
35 def get_details_page_prefix(self) -> str:
36 return "urbanist-details"
38 def should_use_https(self) -> bool:
41 def get_event_time(self, item: xml.etree.ElementTree.Element) -> Optional[datetime.datetime]:
42 return parse(self.find_pubdate(item))
44 def item_is_interesting_for_headlines(
45 self, title: str, description: str, item: xml.etree.ElementTree.Element
47 return description.lower() != 'the urbanist'
49 def do_details(self) -> bool:
52 def item_is_interesting_for_article(
53 self, title: str, description: str, item: xml.etree.ElementTree.Element
55 return len(description) > 20
59 #x = urbanist_renderer(
61 # "Shuffle News" : 1},
62 # "www.theurbanist.org",
65 #if x.fetch_news() == 0:
66 # print("Error fetching news, no items fetched.")