diff --git a/src/calibre/gui2/images/news/fastcompany.png b/src/calibre/gui2/images/news/fastcompany.png new file mode 100644 index 0000000000..542b9f1726 Binary files /dev/null and b/src/calibre/gui2/images/news/fastcompany.png differ diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 6e4c27a5dd..44fb9bd46e 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -51,6 +51,7 @@ recipe_modules = ['recipe_' + r for r in ( 'theeconomictimes_india', '7dias', 'buenosaireseconomico', 'diagonales', 'miradasalsur', 'newsweek_argentina', 'veintitres', 'gva_be', 'hln', 'tijd', 'degentenaar', 'inquirer_net', 'uncrate', + 'fastcompany', 'accountancyage', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_accountancyage.py b/src/calibre/web/feeds/recipes/recipe_accountancyage.py new file mode 100644 index 0000000000..d6be57d514 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_accountancyage.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2008-2009, Darko Miletic ' +''' +www.accountancyage.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Tag + +class AccountancyAge(BasicNewsRecipe): + title = 'Accountancy Age' + __author__ = 'Darko Miletic' + description = 'business news' + publisher = 'accountancyage.com' + category = 'news, politics, finances' + oldest_article = 2 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + simultaneous_downloads = 1 + encoding = 'utf-8' + lang = 'en' + language = _('English') + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' + + keep_only_tags = [dict(name='div', attrs={'class':'bodycol'})] + remove_tags = [dict(name=['embed','object'])] + remove_tags_after = dict(name='div', attrs={'id':'permalink'}) + remove_tags_before = dict(name='div', attrs={'class':'gap6'}) + + feeds = [(u'All News', u'http://feeds.accountancyage.com/rss/latest/accountancyage/all')] + + def print_version(self, url): + rest, sep, miss = url.rpartition('/') + rr, ssep, artid = rest.rpartition('/') + return u'http://www.accountancyage.com/articles/print/' + artid + + def get_article_url(self, article): + return article.get('guid', None) + + def preprocess_html(self, soup): + soup.html['xml:lang'] = self.lang + soup.html['lang'] = self.lang + mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) + mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=UTF-8")]) + soup.head.insert(0,mlang) + soup.head.insert(1,mcharset) + return self.adeify_images(soup) + diff --git a/src/calibre/web/feeds/recipes/recipe_fastcompany.py b/src/calibre/web/feeds/recipes/recipe_fastcompany.py new file mode 100644 index 0000000000..fadbdcfc98 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_fastcompany.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2008-2009, Darko Miletic ' +''' +www.fastcompany.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Tag + +class FastCompany(BasicNewsRecipe): + title = 'Fast Company' + __author__ = 'Darko Miletic' + description = 'Where ideas and people meet' + publisher = 'fastcompany.com' + category = 'news, technology, gadgets, games' + oldest_article = 15 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = True + simultaneous_downloads = 1 + encoding = 'utf-8' + lang = 'en' + language = _('English') + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' + + remove_tags = [dict(name=['embed','object']), dict(name='div',attrs={'class':'feedflare'})] + + feeds = [(u'All News', u'http://feeds.feedburner.com/fastcompany/headlines')] + + def get_article_url(self, article): + return article.get('guid', None) + + def preprocess_html(self, soup): + soup.html['xml:lang'] = self.lang + soup.html['lang'] = self.lang + mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) + mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=UTF-8")]) + soup.head.insert(0,mlang) + soup.head.insert(1,mcharset) + for item in soup.findAll('a'): + sp = item['href'].find('http://feedads.g.doubleclick.net/') + if sp != -1: + item.extract() + return self.adeify_images(soup) +