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-18-2012, 07:30 PM   #1
claviola
Junior Member
claviola began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jun 2012
Device: Kindle Touch
Updated Recipe - O Globo

The old one wasn't working for me at all, so I fixed it.
Also available at https://gist.github.com/2951134

Code:
#!/usr/bin/env python

__license__   = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
'''
oglobo.globo.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class OGlobo(BasicNewsRecipe):
    title                 = 'O Globo'
    __author__            = 'Darko Miletic, Sujata Raman, Carlos Laviola'
    description           = 'News from Brasil'
    publisher             = 'O Globo'
    category              = 'news, politics, Brasil'
    oldest_article        = 7
    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    encoding              = 'cp1252'
    cover_url             = 'http://oglobo.globo.com/_img/o-globo.png'
    remove_javascript     = True

    html2lrf_options = [
                          '--comment', description
                        , '--category', category
                        , '--publisher', publisher
                        ]

    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'

    extra_css = '''
                    cite{color:#007BB5; font-size:xx-small; font-style:italic;}
                    body{font-family:Arial,Helvetica,sans-serif;font-size:x-small;}
                    h3{font-size:large; color:#082963; font-weight:bold;}
                    #ident{color:#0179B4; font-size:xx-small;}
                    p{color:#000000;font-weight:normal;}                    
                    .commentario p{color:#007BB5; font-style:italic;}
                '''
    
    remove_tags = [
                     dict(name='script')
                    ,dict(name='form')
                    ,dict(name='div', attrs={'id':'header'})
                    ,dict(name='p', attrs={'id':'info-date-press'})
                  ]


    feeds = [
               (u'Todos os canais', u'http://oglobo.globo.com/rss.xml?completo=true')
              ,(u'Ciencia', u'http://oglobo.globo.com/rss.xml?secao=ciencia&completo=true')
              ,(u'Educacao', u'http://oglobo.globo.com/rss.xml?secao=educacao&completo=true')
              ,(u'Opiniao', u'http://oglobo.globo.com/rss.xml?secao=opiniao&completo=true')
              ,(u'Cultura', u'http://oglobo.globo.com/rss.xml?secao=cultura&completo=true')
              ,(u'Esportes', u'http://oglobo.globo.com/rss.xml?secao=esportes&completo=true')
              ,(u'Mundo', u'http://oglobo.globo.com/rss.xml?secao=mundo&completo=true')
              ,(u'Pais', u'http://oglobo.globo.com/rss.xml?secao=pais&completo=true')
              ,(u'Rio', u'http://oglobo.globo.com/rss.xml?secao=rio&completo=true')
              ,(u'Saude', u'http://oglobo.globo.com/rss.xml?secao=saude&completo=true')
              ,(u'Economia', u'http://oglobo.globo.com/rss.xml?secao=economia&completo=true')
              ,(u'Tecnologia', u'http://oglobo.globo.com/rss.xml?secao=tecnologia&completo=true')
            ]

    def print_version(self, url):
        return url + '?service=print'

    def preprocess_html(self, soup):
        for item in soup.findAll(style=True):
            del item['style']
        return soup

    language = 'pt_BR'
claviola 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 Italian recipe faber1971 Recipes 0 06-02-2012 05:39 AM
Le Monde: updated recipe veezh Recipes 0 03-27-2012 01:49 PM
Updated recipe for New Scientist kiavash Recipes 0 01-19-2012 06:24 PM
Updated recipe for Le Monde? veezh Recipes 5 01-20-2011 10:06 PM
One new recipe and other one updated (In Spanish) desUBIKado Recipes 3 01-19-2011 04:58 AM


All times are GMT -4. The time now is 04:32 AM.


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