diff --git a/resources/images/news/foxnews.png b/resources/images/news/foxnews.png new file mode 100644 index 0000000000..29f0bbc2dd Binary files /dev/null and b/resources/images/news/foxnews.png differ diff --git a/resources/recipes/foxnews.recipe b/resources/recipes/foxnews.recipe new file mode 100644 index 0000000000..e7e76390b5 --- /dev/null +++ b/resources/recipes/foxnews.recipe @@ -0,0 +1,74 @@ +__license__ = 'GPL v3' +__copyright__ = '2010, Darko Miletic ' +''' +foxnews.com +''' + +import re +from calibre.web.feeds.news import BasicNewsRecipe + +class FoxNews(BasicNewsRecipe): + title = 'FOX News' + __author__ = 'Darko Miletic' + description = 'Breaking News from FOX' + publisher = 'FOXNews.com' + category = 'news, breaking news, latest news, current news, world news, national news, USA' + oldest_article = 2 + max_articles_per_feed = 200 + no_stylesheets = True + encoding = 'utf8' + use_embedded_content = False + language = 'en' + publication_type = 'newsportal' + remove_empty_feeds = True + extra_css = ' body{font-family: Arial,sans-serif } img{margin-bottom: 0.4em} .caption{font-size: x-small} ' + + preprocess_regexps = [ + (re.compile(r'.*?', re.DOTALL|re.IGNORECASE),lambda match: '') + ] + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language + } + + remove_attributes = ['xmlns'] + + keep_only_tags = [ + dict(name='div', attrs={'id' :['story','browse-story-content']}) + ,dict(name='div', attrs={'class':['posts articles','slideshow']}) + ,dict(name='h4' , attrs={'class':'storyDate'}) + ,dict(name='h1' , attrs={'xmlns:functx':'http://www.functx.com'}) + ,dict(name='div', attrs={'class':'authInfo'}) + ,dict(name='div', attrs={'id':'articleCont'}) + ] + + remove_tags = [ + dict(name='div', attrs={'class':['share-links','quigo quigo2','share-text','storyControls','socShare','btm-links']}) + ,dict(name='div', attrs={'id' :['otherMedia','loomia_display','img-all-path','story-vcmId','story-url','pane-browse-story-comments','story_related']}) + ,dict(name='ul' , attrs={'class':['tools','tools alt','tools alt2','tabs']}) + ,dict(name='a' , attrs={'class':'join-discussion'}) + ,dict(name='ul' , attrs={'class':['tools','tools alt','tools alt2']}) + ,dict(name='p' , attrs={'class':'see_fullarchive'}) + ,dict(name=['object','embed','link','script']) + ] + + + feeds = [ + (u'Latest Headlines', u'http://feeds.foxnews.com/foxnews/latest' ) + ,(u'National' , u'http://feeds.foxnews.com/foxnews/national' ) + ,(u'World' , u'http://feeds.foxnews.com/foxnews/world' ) + ,(u'Politics' , u'http://feeds.foxnews.com/foxnews/politics' ) + ,(u'Business' , u'http://feeds.foxnews.com/foxnews/business' ) + ,(u'SciTech' , u'http://feeds.foxnews.com/foxnews/scitech' ) + ,(u'Health' , u'http://feeds.foxnews.com/foxnews/health' ) + ,(u'Entertainment' , u'http://feeds.foxnews.com/foxnews/entertainment' ) + ] + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + return self.adeify_images(soup) +