diff --git a/resources/recipes/longform_org.recipe b/resources/recipes/longform_org.recipe new file mode 100644 index 0000000000..89805a6cd8 --- /dev/null +++ b/resources/recipes/longform_org.recipe @@ -0,0 +1,30 @@ +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: Tumblr + + share_links = soup.findAll('a', {'class': 'twitter-share-button'}) + if (len(share_links)): + return share_links[-1].get('data-url') + return None