Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 06-30-2012, 09:58 AM   #1
desUBIKado
Member
desUBIKado began at the beginning.
 
Posts: 17
Karma: 12
Join Date: Feb 2009
Location: Zaragoza, Spain
Device: prs-505, iliad
Updated recipe: Heraldo de Aragon [ES]

Hi there,

I bring an update to heraldo.es

Spoiler:

Code:
#!/usr/bin/env  python
__license__     = 'GPL v3'
__copyright__   = '04 December 2010, desUBIKado'
__author__      = 'desUBIKado'
__description__ = 'Daily newspaper from Aragon'
__version__     = 'v0.05'
__date__        = '5, Februery 2012'
'''
http://www.heraldo.es/
'''

import time
import re
from calibre.web.feeds.news import BasicNewsRecipe

class heraldo(BasicNewsRecipe):
    author        = 'desUBIKado'
    description   = 'Daily newspaper from Aragon'
    title          = u'Heraldo de Aragon'
    publisher      = 'OJD Nielsen'
    category       = 'News, politics, culture, economy, general interest'
    language       = 'es'
    timefmt        = '[%a, %d %b, %Y]'
    oldest_article = 2
    delay          = 1
    max_articles_per_feed = 100
    use_embedded_content  = False
    remove_javascript = True
    no_stylesheets = True
    

    feeds          = [
                        (u'Portadas', u'http://www.heraldo.es/index.php/mod.portadas/mem.rss')
                     ]


    
    keep_only_tags     = [dict(name='div', attrs={'id':['dts','com']})]     

    remove_tags        = [dict(name='a', attrs={'class':['com flo-r','enl-if','enl-df']}),
                          dict(name='div', attrs={'class':['brb-b-s con marg-btt','cnt-rel con','col5-f1']}),
                          dict(name='form', attrs={'class':'form'}), 
                          dict(name='ul', attrs={'id':['cont-tags','pag-1']})]

    remove_tags_before = dict(name='div' , attrs={'id':'dts'})
    remove_tags_after  = dict(name='div' , attrs={'id':'com'})

    def get_cover_url(self):
       cover = None
       st = time.localtime()
       year = str(st.tm_year)
       month = "%.2d" % st.tm_mon
       day = "%.2d" % st.tm_mday
		#http://oldorigin-www.heraldo.es/2010...ada_aragon.pdf
       cover='http://oldorigin-www.heraldo.es/'+ year +  month + day +'/primeras/portada_aragon.pdf'
       br = BasicNewsRecipe.get_browser()
       try:
           br.open(cover)
       except:
           self.log("\nPortada no disponible")
           cover ='http://www.heraldo.es/MODULOS/global/publico/interfaces/img/logo-Heraldo.png'
       return cover
    

    extra_css = '''
                    .con strong{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:16px;}                       
                    .con h2{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:30px;}               
                    .con span{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:12px;}
                    .ent {font-family:Arial,Helvetica,sans-serif; font-weight:normal; font-style:italic; font-size:18px;}                                                                       
                    img{margin-bottom: 0.4em}
                '''      

    preprocess_regexps = [     

# Para separar los comentarios con una linea en blanco
                           (re.compile(r'<div id="com"', re.DOTALL|re.IGNORECASE), lambda match: '<br><div id="com"')

                         ]


Greetings

Last edited by desUBIKado; 06-30-2012 at 11:47 AM.
desUBIKado is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Updated RealClear*.com Recipe TechnoCat Recipes 0 04-01-2012 08:28 PM
Updated recipe: El periódico de Aragón (Spanish) desUBIKado Recipes 0 02-10-2011 02:17 PM
One new recipe and other one updated (In Spanish) desUBIKado Recipes 3 01-19-2011 03:58 AM


All times are GMT -4. The time now is 06:11 AM.


MobileRead.com is a privately owned, operated and funded community.