| 1 |
# -*- coding: utf-8 -*- |
| 2 |
__license__ = 'GPL v3' |
| 3 |
__copyright__ = '2011 Aurélien Chabot <[email protected]>' |
| 4 |
|
| 5 |
''' |
| 6 |
Fetch zdnet.fr |
| 7 |
''' |
| 8 |
|
| 9 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 10 |
|
| 11 |
|
| 12 |
class zdnet(BasicNewsRecipe): |
| 13 |
title = 'ZDNet.fr' |
| 14 |
__author__ = 'calibre' |
| 15 |
description = 'Actualités' |
| 16 |
encoding = 'utf-8' |
| 17 |
publisher = 'ZDNet.fr' |
| 18 |
category = 'Actualité, Informatique, IT' |
| 19 |
language = 'fr' |
| 20 |
|
| 21 |
use_embedded_content = False |
| 22 |
timefmt = ' [%d %b %Y]' |
| 23 |
max_articles_per_feed = 15 |
| 24 |
no_stylesheets = True |
| 25 |
remove_empty_feeds = True |
| 26 |
filterDuplicates = True |
| 27 |
|
| 28 |
extra_css = ''' |
| 29 |
h1 {font-size:xx-large; font-family:Arial,Helvetica,sans-serif;} |
| 30 |
.contentmetadata p {font-size:xx-small; color:#4D4D4D; font-family:Arial,Helvetica,sans-serif;} |
| 31 |
#content {font-size:medium; font-family:Arial,Helvetica,sans-serif;} |
| 32 |
''' |
| 33 |
|
| 34 |
remove_tags = [ |
| 35 |
dict(name='iframe'), |
| 36 |
dict(name='div', attrs={'class': ['toolbox']}), |
| 37 |
dict(name='div', attrs={'class': ['clear clearfix']}), |
| 38 |
dict(id='emailtoafriend'), |
| 39 |
dict(id='storyaudio'), |
| 40 |
dict(id='fbtwContainer'), |
| 41 |
dict(name='h5'), |
| 42 |
] |
| 43 |
|
| 44 |
remove_tags_before = dict(id='leftcol') |
| 45 |
remove_tags_after = dict(id='content') |
| 46 |
|
| 47 |
feeds = [ |
| 48 |
('Informatique', 'http://www.zdnet.fr/feeds/rss/actualites/informatique/'), |
| 49 |
('Internet', 'http://www.zdnet.fr/feeds/rss/actualites/internet/'), |
| 50 |
('Telecom', 'http://www.zdnet.fr/feeds/rss/actualites/telecoms/'), |
| 51 |
] |
| 52 |
|
| 53 |
def preprocess_html(self, soup): |
| 54 |
for item in soup.findAll(style=True): |
| 55 |
del item['style'] |
| 56 |
return soup |
| 57 |
|
| 58 |
def get_masthead_url(self): |
| 59 |
masthead = 'http://www.zdnet.fr/images/base/logo.png' |
| 60 |
br = BasicNewsRecipe.get_browser(self) |
| 61 |
try: |
| 62 |
br.open(masthead) |
| 63 |
except Exception: |
| 64 |
self.log('\nCover unavailable') |
| 65 |
masthead = None |
| 66 |
return masthead |