| 1 |
#!/usr/bin/env python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
__license__ = 'GPL v3' |
| 5 |
__copyright__ = '2011, Silviu Cotoar\u0103' |
| 6 |
''' |
| 7 |
tvmania.ro |
| 8 |
''' |
| 9 |
|
| 10 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 11 |
|
| 12 |
|
| 13 |
class Tvmania(BasicNewsRecipe): |
| 14 |
title = 'TVmania' |
| 15 |
__author__ = 'Silviu Cotoar\u0103' |
| 16 |
description = 'Programe TV' |
| 17 |
publisher = 'TVmania' |
| 18 |
oldest_article = 25 |
| 19 |
language = 'ro' |
| 20 |
max_articles_per_feed = 100 |
| 21 |
no_stylesheets = True |
| 22 |
use_embedded_content = False |
| 23 |
category = 'Ziare,Reviste,TV' |
| 24 |
encoding = 'utf-8' |
| 25 |
cover_url = 'http://www.tvmania.ro/wp-content/themes/tvmania/images/logo.png' |
| 26 |
|
| 27 |
conversion_options = {'comments': description, 'tags': category, 'language': language, 'publisher': publisher} |
| 28 |
|
| 29 |
extra_css = ''' |
| 30 |
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} |
| 31 |
h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;} |
| 32 |
.byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} |
| 33 |
.date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} |
| 34 |
p{font-family:Arial,Helvetica,sans-serif;font-size:small;} |
| 35 |
.copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center} |
| 36 |
.story{font-family:Arial,Helvetica,sans-serif;font-size:small;} |
| 37 |
.entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;} |
| 38 |
.pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;} |
| 39 |
.maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;} |
| 40 |
.story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;} |
| 41 |
body{font-family:Helvetica,Arial,sans-serif;font-size:small;} |
| 42 |
''' |
| 43 |
|
| 44 |
keep_only_tags = [ |
| 45 |
dict(name='div', attrs={'class': 'articol'}), |
| 46 |
dict(name='font', attrs={'class': 'mic'}), |
| 47 |
dict(name='div', attrs={'id': 'header_recomandari'}), |
| 48 |
dict(name='div', attrs={'class': 'main-image'}), |
| 49 |
dict(name='div', attrs={'id': 'articol_recomandare'}), |
| 50 |
] |
| 51 |
|
| 52 |
remove_tags = [dict(name='div', attrs={'class': ['iLikeThis']}), dict(name='span', attrs={'class': ['tag-links']})] |
| 53 |
|
| 54 |
remove_tags_after = [dict(name='div', attrs={'class': ['iLikeThis']}), dict(name='span', attrs={'class': ['tag-links']})] |
| 55 |
|
| 56 |
feeds = [('Feeds', 'http://www.tvmania.ro/feed')] |
| 57 |
|
| 58 |
def preprocess_html(self, soup): |
| 59 |
return self.adeify_images(soup) |