import generic_news_rss_renderer
import re
+
class google_news_rss_renderer(generic_news_rss_renderer.generic_news_rss_renderer):
def __init__(self, name_to_timeout_dict, feed_site, feed_uris, page_title):
super(google_news_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 "google-news-details"
def find_description(self, item):
- descr = item.findtext('description')
- source = item.findtext('source')
+ descr = item.findtext("description")
+ source = item.findtext("source")
if source is not None:
descr = descr + " (%s)" % source
return descr
def munge_description(self, description):
soup = BeautifulSoup(description)
- for a in soup.findAll('a'):
- del a['href']
+ for a in soup.findAll("a"):
+ del a["href"]
descr = str(soup)
return munge_description_internal(descr)
def item_is_interesting_for_article(self, title, description, item):
return not self.is_item_older_than_n_days(item, 2)
+
# Test
-#x = google_news_rss_renderer(
+# x = google_news_rss_renderer(
# {"Fetch News" : 1,
# "Shuffle News" : 1},
# "news.google.com",
# [ "/rss?hl=en-US&gl=US&ceid=US:en" ],
# "Test" )
-#if x.fetch_news() == 0:
+# if x.fetch_news() == 0:
# print("Error fetching news, no items fetched.")
-#x.shuffle_news()
+# x.shuffle_news()
#
-#descr = "this is a lot of really long text about nothign in particular. It's pretty interesting, don't you think? I hope that the munge description method works by both truncating it and remembering to close any open <LI>items as well as making sure not to truncate in the middle of a <A HREF=\"whatever\" these are a bunch of useless arguments to the A tag that make it really long so that the truncate will happen in the middle of it. I'm getting kind of tired of typing shit so I'm going to revert to copy pasta now. Sorry if you were getting into this story. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</A></LI> Out!"
-#d = x.munge_description_internal(descr)
-#print(d)
-
+# descr = "this is a lot of really long text about nothign in particular. It's pretty interesting, don't you think? I hope that the munge description method works by both truncating it and remembering to close any open <LI>items as well as making sure not to truncate in the middle of a <A HREF=\"whatever\" these are a bunch of useless arguments to the A tag that make it really long so that the truncate will happen in the middle of it. I'm getting kind of tired of typing shit so I'm going to revert to copy pasta now. Sorry if you were getting into this story. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</A></LI> Out!"
+# d = x.munge_description_internal(descr)
+# print(d)