diff --git a/recipes/amspec.recipe b/recipes/amspec.recipe index e5a76a4f86..684b28cf5c 100644 --- a/recipes/amspec.recipe +++ b/recipes/amspec.recipe @@ -18,25 +18,16 @@ class TheAmericanSpectator(BasicNewsRecipe): use_embedded_content = False language = 'en' INDEX = 'http://spectator.org' - - conversion_options = { + auto_cleanup = True + encoding = 'utf-8' + + conversion_options = { 'comments' : description ,'tags' : category ,'language' : language ,'publisher' : publisher } - keep_only_tags = [ - dict(name='div', attrs={'class':'post inner'}) - ,dict(name='div', attrs={'class':'author-bio'}) - ] - - remove_tags = [ - dict(name='object') - ,dict(name='div', attrs={'class':['col3','post-options','social']}) - ,dict(name='p' , attrs={'class':['letter-editor','meta']}) - ] - feeds = [ (u'Articles', u'http://feeds.feedburner.com/amspecarticles')] def get_cover_url(self): @@ -48,10 +39,10 @@ class TheAmericanSpectator(BasicNewsRecipe): link_item2 = soup2.find('div',attrs={'class':'post inner issues'}) cover_url = self.INDEX + link_item2.img['src'] return cover_url - + def print_version(self, url): return url + '/print' - + def get_article_url(self, article): return article.get('guid', None) - + diff --git a/recipes/diario_la_republica.recipe b/recipes/diario_la_republica.recipe new file mode 100644 index 0000000000..1f0e0d565b --- /dev/null +++ b/recipes/diario_la_republica.recipe @@ -0,0 +1,11 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1317341449(BasicNewsRecipe): + title = u'Diario La Republica' + __author__ = 'CAVALENCIA' + oldest_article = 7 + max_articles_per_feed = 100 + auto_cleanup = True + language = 'es_CO' + + feeds = [(u'Diario La Republica', u'http://www.larepublica.com.co/rss/larepublica.xml')] diff --git a/recipes/el_colombiano.recipe b/recipes/el_colombiano.recipe index 492229dc4f..7a413529bb 100644 --- a/recipes/el_colombiano.recipe +++ b/recipes/el_colombiano.recipe @@ -2,12 +2,10 @@ from calibre.web.feeds.news import BasicNewsRecipe - - class AdvancedUserRecipe1311790237(BasicNewsRecipe): title = u'Periódico El Colombiano' - language = 'es_CO' __author__ = 'BIGO-CAVA' + language = 'es_CO' cover_url = 'http://www.elcolombiano.com/images/logoElColombiano348x46.gif' remove_tags_before = dict(id='contenidoArt') remove_tags_after = dict(id='enviaTips') diff --git a/recipes/el_espectador.recipe b/recipes/el_espectador.recipe new file mode 100644 index 0000000000..b7187cbdf3 --- /dev/null +++ b/recipes/el_espectador.recipe @@ -0,0 +1,54 @@ +# coding=utf-8 + +from calibre.web.feeds.news import BasicNewsRecipe + +class ColombiaElEspectador(BasicNewsRecipe): + title = u'Periódico el Espectador' + __author__ = 'BIGO-CAVA' + cover_url = 'http://www.elespectador.com/sites/elespectador.com/themes/elespectador/images/logo.gif' + #remove_tags_before = dict(id='fb-root') + remove_tags_before = dict(id='content') + remove_tags_after = [dict(name='div', attrs={'class':'paginacion'})] + language = 'es_CO' + #keep_only_tags = [dict(name='div', id='content')] + remove_tags = [dict(name='div', attrs={'class':'herramientas_nota'}), + dict(name='div', attrs={'class':'relpauta'}), + dict(name='div', attrs={'class':'recursosrelacionados'}), + dict(name='div', attrs={'class':'nav_negocios'})] + # dict(name='div', attrs={'class':'tags_playerrecurso'}), + # dict(name='div', attrs={'class':'ico-mail2'}), + # dict(name='div', attrs={'id':'caja-instapaper'}), + # dict(name='div', attrs={'class':'modulo herramientas'})] + oldest_article = 2 + max_articles_per_feed = 100 + remove_javascript = True + no_stylesheets = True + use_embedded_content = False + remove_empty_feeds = True + masthead_url = 'http://www.elespectador.com/sites/elespectador.com/themes/elespectador/images/logo.gif' + publication_type = 'newspaper' + + extra_css = """ + p{text-align: justify; font-size: 100%} + body{ text-align: left; font-size:100% } + h1{font-family: sans-serif; font-size:150%; font-weight:bold; text-align: justify; } + h3{font-family: sans-serif; font-size:100%; font-style: italic; text-align: justify; } + """ + + + feeds = [(u'Política ', u' http://www.elespectador.com/noticias/politica/feed'), + (u'Judicial', u'http://www.elespectador.com/noticias/judicial/feed'), + (u'Paz', u'http://www.elespectador.com/noticias/paz/feed'), + (u'Economía', u'http://www.elespectador.com/economia/feed'), + (u'Soy Periodista', u'http://www.elespectador.com/noticias/soyperiodista/feed'), + (u'Investigación', u'http://www.elespectador.com/noticias/investigacion/feed'), + (u'Educación', u'http://www.elespectador.com/noticias/educacion/feed'), + (u'Salud', u'http://www.elespectador.com/noticias/salud/feed'), + (u'El Mundo', u'http://www.elespectador.com/noticias/elmundo/feed'), + (u'Nacional', u'http://www.elespectador.com/noticias/nacional/feed'), + (u'Bogotá', u'http://www.elespectador.com/noticias/bogota/feed'), + (u'Deportes', u'http://www.elespectador.com/deportes/feed'), + (u'Tecnología', u'http://www.elespectador.com/tecnologia/feed'), + (u'Actualidad', u'http://www.elespectador.com/noticias/actualidad/feed'), + (u'Opinión', u'http://www.elespectador.com/opinion/feed'), + (u'Editorial', u'http://www.elespectador.com/opinion/editorial/feed')] diff --git a/recipes/el_mundo_co.recipe b/recipes/el_mundo_co.recipe new file mode 100644 index 0000000000..a8186673d5 --- /dev/null +++ b/recipes/el_mundo_co.recipe @@ -0,0 +1,50 @@ + +from calibre.web.feeds.news import BasicNewsRecipe + +class ColombiaElMundo02(BasicNewsRecipe): + title = u'Periódico El Mundo' + __author__ = 'BIGO-CAVA' + language = 'es_CO' + cover_url = 'http://www.elmundo.com/portal/img/logo_mundo2.png' + remove_tags_before = dict(id='miga_pan') + #remove_tags_before = [dict(name='div', attrs={'class':'contenido'})] + remove_tags_after = [dict(name='div', attrs={'class':'cuadro_opciones_new1'})] + #keep_only_tags = [dict(name='div', id='miga_pan')] + remove_tags = [dict(name='div', attrs={'class':'ruta'}), + dict(name='div', attrs={'class':'buscador'}), + dict(name='div', attrs={'class':'iconos'}), + dict(name='div', attrs={'class':'otros_iconos'}), + dict(name='div', attrs={'class':'cuadro_opciones_new1'}), + dict(name='div', attrs={'class':'otras_noticias'}), + dict(name='div', attrs={'class':'notas_relacionadas'}), + dict(name='div', attrs={'id':'lateral_2'})] + oldest_article = 2 + max_articles_per_feed = 100 + remove_javascript = True + no_stylesheets = True + use_embedded_content = False + remove_empty_feeds = True + masthead_url = 'http://www.elmundo.com/portal/img/logo_mundo2.png' + publication_type = 'newspaper' + + extra_css = """ + p{text-align: justify; font-size: 100%} + body{ text-align: left; font-size:100% } + h1{font-family: sans-serif; font-size:150%; font-weight:bold; text-align: justify; } + h3{font-family: sans-serif; font-size:100%; font-style: italic; text-align: justify; } + """ + + + feeds = [(u'Opinión', u'http://www.elmundo.com/images/rss/opinion.xml'), + (u'Economía', u'http://www.elmundo.com/images/rss/noticias_economia.xml'), + (u'Deportes', u'http://www.elmundo.com/images/rss/deportes.xml'), + (u'Política ', u'http://www.elmundo.com/images/rss/noticias_politica.xml'), + (u'Antioquia', u'http://www.elmundo.com/images/rss/noticias_antioquia.xml'), + (u'Nacional ', u'http://www.elmundo.com/images/rss/noticias_nacional.xml'), + (u'Internacional', u'http://www.elmundo.com/images/rss/noticias_internacional.xml'), + (u'Servicios Públicos', u'http://www.elmundo.com/images/rss/noticias_servicios_publicos.xml'), + (u'Infraestructura', u'http://www.elmundo.com/images/rss/noticias_infraestructura.xml'), + (u'Mobilidad', u'http://www.elmundo.com/images/rss/noticias_movilidad.xml'), + (u'Derechos Humanos', u'http://www.elmundo.com/images/rss/noticias_derechos_humanos.xml'), + (u'Vida', u'http://www.elmundo.com/images/rss/vida.xml'), + (u'Cultura', u'http://www.elmundo.com/images/rss/cultura.xml')] diff --git a/recipes/el_tiempo.recipe b/recipes/el_tiempo.recipe index 3a10cca767..794e75df7d 100644 --- a/recipes/el_tiempo.recipe +++ b/recipes/el_tiempo.recipe @@ -2,18 +2,17 @@ from calibre.web.feeds.news import BasicNewsRecipe - - - class ColombiaElTiempo02(BasicNewsRecipe): title = u'Periódico el Tiempo' - language = 'es_CO' __author__ = 'BIGO-CAVA' + language = 'es_CO' cover_url = 'http://www.eltiempo.com/media/css/images/logo_footer.png' - remove_tags_before = dict(id='fb-root') + #remove_tags_before = dict(id='fb-root') + remove_tags_before = dict(id='contenidoArt') remove_tags_after = [dict(name='div', attrs={'class':'modulo reporte'})] keep_only_tags = [dict(name='div', id='contenidoArt')] remove_tags = [dict(name='div', attrs={'class':'social-media'}), + dict(name='div', attrs={'class':'recomend-art'}), dict(name='div', attrs={'class':'caja-facebook'}), dict(name='div', attrs={'class':'caja-twitter'}), dict(name='div', attrs={'class':'caja-buzz'}), diff --git a/recipes/gosc_niedzielny.recipe b/recipes/gosc_niedzielny.recipe new file mode 100644 index 0000000000..12942f0f8a --- /dev/null +++ b/recipes/gosc_niedzielny.recipe @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2011, Piotr Kontek, piotr.kontek@gmail.com' + +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ptempfile import PersistentTemporaryFile +import re + +class GN(BasicNewsRecipe): + EDITION = 0 + + __author__ = 'Piotr Kontek' + title = u'Gość niedzielny' + description = 'Weekly magazine' + encoding = 'utf-8' + no_stylesheets = True + language = 'pl' + remove_javascript = True + temp_files = [] + + articles_are_obfuscated = True + + def get_obfuscated_article(self, url): + br = self.get_browser() + br.open(url) + source = br.response().read() + page = self.index_to_soup(source) + + main_section = page.find('div',attrs={'class':'txt doc_prnt_prv'}) + + title = main_section.find('h2') + info = main_section.find('div', attrs={'class' : 'cf doc_info'}) + authors = info.find(attrs={'class':'l'}) + article = str(main_section.find('p', attrs={'class' : 'doc_lead'})) + first = True + for p in main_section.findAll('p', attrs={'class':None}, recursive=False): + if first and p.find('img') != None: + article = article + '
' + article = article + str(p.find('img')).replace('src="/files/','src="http://www.gosc.pl/files/') + article = article + '' + for s in p.findAll('span'): + article = article + self.tag_to_string(s) + article = article + '
' + else: + article = article + str(p).replace('src="/files/','src="http://www.gosc.pl/files/') + first = False + + html = unicode(title) + unicode(authors) + unicode(article) + + self.temp_files.append(PersistentTemporaryFile('_temparse.html')) + self.temp_files[-1].write(html) + self.temp_files[-1].close() + return self.temp_files[-1].name + + def find_last_issue(self): + soup = self.index_to_soup('http://gosc.pl/wyszukaj/wydania/3.Gosc-Niedzielny') + #szukam zdjęcia i linka do porzedniego pełnego numeru + first = True + for d in soup.findAll('div', attrs={'class':'l release_preview_l'}): + img = d.find('img') + if img != None: + a = img.parent + self.EDITION = a['href'] + self.title = img['alt'] + self.cover_url = 'http://www.gosc.pl' + img['src'] + if not first: + break + first = False + + def parse_index(self): + self.find_last_issue() + soup = self.index_to_soup('http://www.gosc.pl' + self.EDITION) + feeds = [] + #wstepniak + a = soup.find('div',attrs={'class':'release-wp-b'}).find('a') + articles = [ + {'title' : self.tag_to_string(a), + 'url' : 'http://www.gosc.pl' + a['href'].replace('/doc/','/doc_pr/'), + 'date' : '', + 'description' : ''} + ] + feeds.append((u'Wstępniak',articles)) + #kategorie + for addr in soup.findAll('a',attrs={'href':re.compile('kategoria')}): + if addr.string != u'wszystkie artyku\u0142y z tej kategorii \xbb': + main_block = self.index_to_soup('http://www.gosc.pl' + addr['href']) + articles = list(self.find_articles(main_block)) + if len(articles) > 0: + section = addr.string + feeds.append((section, articles)) + return feeds + + def find_articles(self, main_block): + for a in main_block.findAll('div', attrs={'class':'prev_doc2'}): + art = a.find('a') + yield { + 'title' : self.tag_to_string(art), + 'url' : 'http://www.gosc.pl' + art['href'].replace('/doc/','/doc_pr/'), + 'date' : '', + 'description' : '' + } + for a in main_block.findAll('div', attrs={'class':'sr-document'}): + art = a.find('a') + yield { + 'title' : self.tag_to_string(art), + 'url' : 'http://www.gosc.pl' + art['href'].replace('/doc/','/doc_pr/'), + 'date' : '', + 'description' : '' + } + diff --git a/recipes/portafolio.recipe b/recipes/portafolio.recipe index 1b442f68f7..4ba0d16c46 100644 --- a/recipes/portafolio.recipe +++ b/recipes/portafolio.recipe @@ -4,13 +4,13 @@ from calibre.web.feeds.news import BasicNewsRecipe class AdvancedUserRecipe1311799898(BasicNewsRecipe): title = u'Periódico Portafolio Colombia' - language = 'es_CO' __author__ = 'BIGO-CAVA' + language = 'es_CO' cover_url = 'http://www.portafolio.co/sites/portafolio.co/themes/portafolio_2011/logo.png' remove_tags_before = dict(id='contenidoArt') remove_tags_after = [dict(name='div', attrs={'class':'articulo-mas'})] keep_only_tags = [dict(name='div', id='contenidoArt')] - oldest_article = 1 + oldest_article = 2 max_articles_per_feed = 100 remove_javascript = True no_stylesheets = True diff --git a/recipes/readitlater.recipe b/recipes/readitlater.recipe index 4bd8fc2bd6..ea9c92868b 100644 --- a/recipes/readitlater.recipe +++ b/recipes/readitlater.recipe @@ -1,5 +1,8 @@ __license__ = 'GPL v3' -__copyright__ = '2010, Darko Miletic