4 from typing import Dict, List, Optional
7 from dateutil.parser import parse
9 import generic_news_rss_renderer as gnrss
12 # https://www.theurbanist.org/feed/
13 class urbanist_renderer(gnrss.generic_news_rss_renderer):
14 """Read the The Urbanist feed."""
18 name_to_timeout_dict: Dict[str, int],
24 name_to_timeout_dict, feed_site, feed_uris, page_title
28 def debug_prefix(self) -> str:
29 return f"urbanist({self.page_title})"
31 def get_headlines_page_prefix(self) -> str:
34 def get_details_page_prefix(self) -> str:
35 return "urbanist-details"
37 def should_use_https(self) -> bool:
40 def get_event_time(self, item: xml.etree.ElementTree.Element) -> Optional[datetime.datetime]:
41 return parse(self.find_pubdate(item))
43 def item_is_interesting_for_headlines(
44 self, title: str, description: str, item: xml.etree.ElementTree.Element
46 return self.find_pubdate(item) is not None and 'urbanist' not in title.lower()
48 def do_details(self) -> bool:
51 def item_is_interesting_for_article(
52 self, title: str, description: str, item: xml.etree.ElementTree.Element
54 return len(description) > 30
58 #x = urbanist_renderer(
60 # "Shuffle News" : 1},
61 # "www.theurbanist.org",
64 #if x.fetch_news() == 0:
65 # print("Error fetching news, no items fetched.")