From c1cc20c3c973797852f7d99cd91b7dede63e0329 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 17 Apr 2010 10:36:51 +0530 Subject: [PATCH] FOX News by DM --- resources/images/news/foxnews.png | Bin 0 -> 467 bytes resources/recipes/foxnews.recipe | 74 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 resources/images/news/foxnews.png create mode 100644 resources/recipes/foxnews.recipe diff --git a/resources/images/news/foxnews.png b/resources/images/news/foxnews.png new file mode 100644 index 0000000000000000000000000000000000000000..29f0bbc2dd87e759fdcba89635a69d7116662aec GIT binary patch literal 467 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*VRoIjo}jv*GOr%v3Pd&GdJHNJ^~F({KIbY-b@ z0n7RV=?a$I1%gj_ZJKNx7|JrI@>X!O=({EyFFW^bCWCa-`^V>*8P08<;xuW^Rv`x0 zmgFfxJKi1NW#HzO$*AJ_{;!=vi-BpofY{~ap6^Gz9d2*y{(Akn3{%m$%fCM7x;!y# zSmn3^oB5@Uc-j0XT|@H_Ljx;g6Dw0AZ39y)0|TCyD>G3vFVdQ&MBb@0M8t+{r~^~ literal 0 HcmV?d00001 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) +