import generic_news_rss_renderer class wsj_rss_renderer(generic_news_rss_renderer.generic_news_rss_renderer): def __init__(self, name_to_timeout_dict, feed_site, feed_uris, page_title): super(wsj_rss_renderer, self).__init__( name_to_timeout_dict, feed_site, feed_uris, page_title) self.debug = 1 def debug_prefix(self): return "wsj(%s)" % (self.page_title) def get_headlines_page_prefix(self): return "wsj-%s" % (self.page_title) def get_details_page_prefix(self): return "wsj-details-%s" % (self.page_title) def find_image(self, item): image = item.findtext('image') if image is not None: url = image.get('url') return url return None def should_use_https(self): return True def item_is_interesting_for_headlines(self, title, description, item): if self.is_item_older_than_n_days(item, 7): self.debug_print("%s: is too old!" % title) return False return ("WSJ.com" not in title and "WSJ.com" not in description) def item_is_interesting_for_article(self, title, description, item): if self.is_item_older_than_n_days(item, 7): self.debug_print("%s: is too old!" % title) return False return ("WSJ.com" not in title and "WSJ.com" not in description) # Test #x = wsj_rss_renderer( # {"Fetch News" : 1, # "Shuffle News" : 1}, # "feeds.a.dj.com", # [ "/rss/RSSWorldNews.xml" ], # "Test" ) #if x.fetch_news() == 0: # print "Error fetching news, no items fetched." #x.shuffle_news()