View Single Post
Old 05-18-2010, 01:47 PM   #1931
sdow1
Connoisseur
sdow1 began at the beginning.
 
Posts: 53
Karma: 10
Join Date: Apr 2010
Location: new york city
Device: nook, ipad
Quote:
Originally Posted by mwheinz View Post
American Prospect Recipe

sdow1 - try this recipe. It's very simple, strips out all formatting at the moment.

Code:
import re

class AdvancedUserRecipe1273850169(BasicNewsRecipe):
    title          = u'American Prospect'
    oldest_article = 7
    max_articles_per_feed = 100
    recursions = 0
    no_stylesheets = True
    remove_javascript = True

    keep_only_tags = [dict(name=['p','img'])]
	
    preprocess_regexps = [ 
        (re.compile('\r'),lambda match: ''),
        (re.compile(r'<head.*?<title>', re.DOTALL|re.IGNORECASE), lambda match: '<head><title>'),
        (re.compile(r'</title>.*?</head>', re.DOTALL|re.IGNORECASE), lambda match: '</title></head>'),
        (re.compile(r'<body.*?<div class="pad_10L10R">', re.DOTALL|re.IGNORECASE), lambda match: '<body><div>'),
        (re.compile(r'</div>.*</body>', re.DOTALL|re.IGNORECASE), lambda match: '</div></body>'),
    ]

    feeds       = [(u'Articles', u'feed://www.prospect.org/articles_rss.jsp')]
In looking at this further, the only thing I'd change for now is to change the oldest article limit (to 30), since TAP is a monthly magazine. I can do this myself on my copy, but just wanted to put it out there for anyone else.
sdow1 is offline