New recipe for La Mujer De mi Vida by Darko Miletic

This commit is contained in:
Kovid Goyal 2009-02-25 16:20:26 -08:00
parent 3ea924b1d3
commit 0426b3150f
2 changed files with 77 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,76 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
'''
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 = '<meta http-equiv="Content-Language" content="es-AR"/>'
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