Monthly Archives: July 2015

Python: Problem Set 5

Problem Set 5 makes use of Google’s RSS feed to search for keywords and return stories matching those words. The exercise I believe is the first to begin using classes and inheritance. In order to avoid code duplication, a generic WordTrigger is created to look for for a “word” inside a “text.” Then, we create subclasses of triggers to look at the title, summary, or subject fields. Later on, it creates AND/OR functions to make more useful searches.

My functions passed the ps6_test.py, but when I try using provided main_thread’s implementation that pulls RSS stories from google (stories = process(“http://news.google.com/?output=rss”)), only the title trigger seemed to work. I suspect the provided feedparser.py may not be up to date with the RSS feed. On the other hand, feedparser.py looks like it is mapping the description element to “summary”, so the error is not obvious to me.