From 0426b3150f68228131884b556cc72441c7fd1f8a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 25 Feb 2009 16:20:26 -0800 Subject: [PATCH] New recipe for La Mujer De mi Vida by Darko Miletic --- src/calibre/web/feeds/recipes/__init__.py | 1 + .../feeds/recipes/recipe_lamujerdemivida.py | 76 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 src/calibre/web/feeds/recipes/recipe_lamujerdemivida.py diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 7ae997f90d..5c4976eb27 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -32,6 +32,7 @@ recipe_modules = ['recipe_' + r for r in ( 'hindu', 'cincinnati_enquirer', 'physics_world', 'pressonline', 'la_republica', 'physics_today', 'chicago_tribune', 'e_novine', 'al_jazeera', 'winsupersite', 'borba', 'courrierinternational', + 'lamujerdemivida', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_lamujerdemivida.py b/src/calibre/web/feeds/recipes/recipe_lamujerdemivida.py new file mode 100644 index 0000000000..a99be8f955 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_lamujerdemivida.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +lamujerdemivida.com.ar +''' +from calibre import strftime +from calibre.web.feeds.news import BasicNewsRecipe + +class LaMujerDeMiVida(BasicNewsRecipe): + title = 'La Mujer de mi Vida' + __author__ = 'Darko Miletic' + description = 'Cultura de otra manera' + oldest_article = 90 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + encoding = 'cp1252' + publisher = 'La Mujer de mi Vida' + category = 'literatura, critica, arte, ensayos' + language = _('Spanish') + INDEX = 'http://www.lamujerdemivida.com.ar/' + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + , '--ignore-tables' + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True' + + keep_only_tags = [dict(name='table', attrs={'width':'570'})] + + feeds = [(u'Articulos', u'http://www.lamujerdemivida.com.ar/index.php')] + + def preprocess_html(self, soup): + soup.html['xml:lang'] = 'es-AR' + soup.html['lang'] = 'es-AR' + mtag = '' + soup.head.insert(0,mtag) + for item in soup.findAll(style=True): + del item['style'] + return soup + + def get_cover_url(self): + cover_url = None + soup = self.index_to_soup(self.INDEX) + cover_item = soup.find('img',attrs={'alt':'Lamujerdemivida.'}) + if cover_item: + cover_url = self.INDEX + cover_item['src'] + return cover_url + + def parse_index(self): + totalfeeds = [] + lfeeds = self.get_feeds() + for feedobj in lfeeds: + feedtitle, feedurl = feedobj + self.report_progress(0, _('Fetching feed')+' %s...'%(feedtitle if feedtitle else feedurl)) + articles = [] + soup = self.index_to_soup(feedurl) + for item in soup.findAll('td', attrs={'width':'390'}): + atag = item.find('a',href=True) + if atag: + url = atag['href'] + title = self.tag_to_string(atag) + date = strftime(self.timefmt) + articles.append({ + 'title' :title + ,'date' :date + ,'url' :url + ,'description':'' + }) + totalfeeds.append((feedtitle, articles)) + return totalfeeds +