Improve evz.ro

This commit is contained in:
Kovid Goyal 2011-03-07 11:22:26 -07:00
parent 868d4ce31a
commit c9234596bd
2 changed files with 39 additions and 37 deletions

View File

@ -1,52 +1,54 @@
# -*- coding: utf-8 -*-
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = u'2011, Silviu Cotoar\u0103'
''' '''
evz.ro evz.ro
''' '''
import re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class EVZ_Ro(BasicNewsRecipe): class EvenimentulZilei(BasicNewsRecipe):
title = 'evz.ro' title = u'Evenimentul Zilei'
__author__ = 'Darko Miletic' __author__ = u'Silviu Cotoar\u0103'
description = 'News from Romania' description = ''
publisher = 'evz.ro' publisher = u'Evenimentul Zilei'
category = 'news, politics, Romania' oldest_article = 5
oldest_article = 2
max_articles_per_feed = 200
no_stylesheets = True
encoding = 'utf8'
use_embedded_content = False
language = 'ro' language = 'ro'
masthead_url = 'http://www.evz.ro/fileadmin/images/logo.gif' max_articles_per_feed = 100
extra_css = ' body{font-family: Georgia,Arial,Helvetica,sans-serif } .firstP{font-size: 1.125em} .author,.articleInfo{font-size: small} ' no_stylesheets = True
use_embedded_content = False
category = 'Ziare,Stiri'
encoding = 'utf-8'
cover_url = 'http://www.evz.ro/fileadmin/images/evzLogo.png'
conversion_options = { conversion_options = {
'comment' : description 'comments' : description
, 'tags' : category ,'tags' : category
, 'publisher' : publisher ,'language' : language
, 'language' : language ,'publisher' : publisher
} }
preprocess_regexps = [ keep_only_tags = [
(re.compile(r'<head>.*?<title>', re.DOTALL|re.IGNORECASE),lambda match: '<head><title>') dict(name='div', attrs={'class':'single'})
,(re.compile(r'</title>.*?</head>', re.DOTALL|re.IGNORECASE),lambda match: '</title></head>') , dict(name='img', attrs={'id':'placeholder'})
] , dict(name='a', attrs={'id':'holderlink'})
]
remove_tags = [ remove_tags = [
dict(name=['form','embed','iframe','object','base','link','script','noscript']) dict(name='p', attrs={'class':['articleInfo']})
,dict(attrs={'class':['section','statsInfo','email il']}) , dict(name='div', attrs={'id':['bannerAddoceansArticleJos']})
,dict(attrs={'id' :'gallery'}) , dict(name='div', attrs={'id':['bannerAddoceansArticle']})
] ]
remove_tags_after = dict(attrs={'class':'section'}) remove_tags_after = [
keep_only_tags = [dict(attrs={'class':'single'})] dict(name='div', attrs={'id':['bannerAddoceansArticleJos']})
remove_attributes = ['height','width'] ]
feeds = [(u'Articles', u'http://www.evz.ro/rss.xml')] feeds = [
(u'Feeds', u'http://www.evz.ro/rss.xml')
]
def preprocess_html(self, soup): def preprocess_html(self, soup):
for item in soup.findAll(style=True): return self.adeify_images(soup)
del item['style']
return soup

View File

@ -14,7 +14,7 @@ class NationalGeoRo(BasicNewsRecipe):
__author__ = u'Silviu Cotoar\u0103' __author__ = u'Silviu Cotoar\u0103'
description = u'S\u0103 avem grij\u0103 de planet\u0103' description = u'S\u0103 avem grij\u0103 de planet\u0103'
publisher = 'National Geographic' publisher = 'National Geographic'
oldest_article = 5 oldest_article = 35
language = 'ro' language = 'ro'
max_articles_per_feed = 100 max_articles_per_feed = 100
no_stylesheets = True no_stylesheets = True