import generic_news_rss_renderer as gnrss
import re
+
class bellevue_reporter_rss_renderer(gnrss.generic_news_rss_renderer):
def __init__(self, name_to_timeout_dict, feed_site, feed_uris, page_title):
super(bellevue_reporter_rss_renderer, self).__init__(
- name_to_timeout_dict,
- feed_site,
- feed_uris,
- page_title)
+ name_to_timeout_dict, feed_site, feed_uris, page_title
+ )
self.debug = 1
def debug_prefix(self):
return True
def munge_description(self, description):
- description = re.sub('<[^>]+>', '', description)
- description = re.sub('Bellevue\s+Reporter\s+Bellevue\s+Reporter', '',
- description)
- description = re.sub('\s*\-\s*Your local homepage\.\s*', '', description)
+ description = re.sub("<[^>]+>", "", description)
+ description = re.sub(
+ "Bellevue\s+Reporter\s+Bellevue\s+Reporter", "", description
+ )
+ description = re.sub("\s*\-\s*Your local homepage\.\s*", "", description)
return description
def item_is_interesting_for_headlines(self, title, description, item):
if self.is_item_older_than_n_days(item, 10):
self.debug_print("%s: is too old!" % title)
return False
+ if (
+ title.find("NFL") != -1
+ or re.search("[Ll]ive [Ss]tream", title) != None
+ or re.search("[Ll]ive[Ss]tream", title) != None
+ or re.search("[Ll]ive [Ss]tream", description) != None
+ ):
+ self.debug_print("%s: looks like it's about football." % title)
+ return False
return True
def item_is_interesting_for_article(self, title, description, item):
if self.is_item_older_than_n_days(item, 10):
self.debug_print("%s: is too old!" % title)
return False
+ if (
+ title.find(" NFL") != -1
+ or re.search("[Ll]ive [Ss]tream", title) != None
+ or re.search("[Ll]ive[Ss]tream", title) != None
+ or re.search("[Ll]ive [Ss]tream", description) != None
+ ):
+ self.debug_print("%s: looks like it's about football." % title)
+ return False
return True
+
# Test
-#x = bellevue_reporter_rss_renderer(
+# x = bellevue_reporter_rss_renderer(
# {"Fetch News" : 1,
# "Shuffle News" : 1},
# "www.bellevuereporter.com",
# [ "/feed/" ],
# "Test" )
-#d = """
-#<DIV style="padding:8px;
+# d = """
+# <DIV style="padding:8px;
# font-size:44pt;
# -webkit-column-break-inside:avoid;"><P>
-#<B>Task force will tackle issues of racial justice, police reform</B>
-#<BR>Bellevue Reporter
-#Bellevue Reporter - Your local homepage.
-#Inslee names civil rights activists, pastors, and cops to panel that may forge ideas f#or new laws Task force will tackle issues of racial justice, police reform
-#Wire Service
-#</DIV>"""
-#d = x.munge_description(d)
-#print d
-#if x.fetch_news() == 0:
+# <B>Task force will tackle issues of racial justice, police reform</B>
+# <BR>Bellevue Reporter
+# Bellevue Reporter - Your local homepage.
+# Inslee names civil rights activists, pastors, and cops to panel that may forge ideas f#or new laws Task force will tackle issues of racial justice, police reform
+# Wire Service
+# </DIV>"""
+# d = x.munge_description(d)
+# print d
+# if x.fetch_news() == 0:
# print "Error fetching news, no items fetched."
-#x.shuffle_news()
+# x.shuffle_news()