Fixed my recipe for The Progressive using code from the recipe for Alternet! Here it is, for anyone else who wants it (it doesn't get you the whole magazine, just a few articles and some web-only content):
Code:
from calibre.ptempfile import PersistentTemporaryFile
class AdvancedUserRecipe1322154189(BasicNewsRecipe):
title = u'the Progressive'
masthead_url = 'http://progressive.org/sites/all/themes/progress/logo.png'
oldest_article = 7
articles_are_obfuscated = True
use_embedded_content = False
auto_cleanup = True
temp_files= []
feeds = [u'http://feeds.feedburner.com/progressivefeed']
def get_article_url(self, article):
return article.get('link', None)
def get_obfuscated_article(self, url):
br = self.get_browser()
br.open(url)
response = br.follow_link(url_regex = r'/print/[0-9]+', nr = 0)
html = response.read()
self.temp_files.append(PersistentTemporaryFile('_fa.html'))
self.temp_files[-1].write(html)
self.temp_files[-1].close()
return self.temp_files[-1].name
def get_cover_url(self):
soup = self.index_to_soup('http://progressive.org')
item = soup.find('div',attrs={'class':'views-field-field-cover-fid'})
if item:
return item.img['src']
return None