This commit is contained in:
Kovid Goyal 2011-02-14 11:42:20 -07:00
parent 9a21c6e8ad
commit a7b652e8ff

View File

@ -1,30 +0,0 @@
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup
class LongForm(BasicNewsRecipe):
title = u'Longform.org'
language = 'en'
description = '''
Longform.org posts new and classic non-fiction articles, curated from across
the web, that are too long and too interesting to be read on a web browser.
'''
__author__ = 'David Blackman'
oldest_article = 7 #days
max_articles_per_feed = 25
no_stylesheets = True
cover_url = 'http://longform.org/wp-content/themes/grid_focus/images/longform_flag.jpg'
feeds = [(u'All', u'http://longform.org/feed/')]
def get_article_url(self, article):
url = article.get('link')
raw = self.browser.open(url).read()
soup = BeautifulSoup(raw.decode('utf8', 'replace'))
# this might be more reliable: <a href="http://www.addtoany.com/add_to/tumblr?linkurl=http://english.aljazeera.net/indepth/opinion/2011/02/20112101030726228.html&amp;linkname=WhyEgypt&#8217;s Progressives Win%20%5Bvia%20Longform.org%5D" target="blank"><img src="http://longform.org/wp-content/themes/grid_focus/images/tumblr.png" border="0px">Tumblr</a>
share_links = soup.findAll('a', {'class': 'twitter-share-button'})
if (len(share_links)):
return share_links[-1].get('data-url')
return None