~ubuntu-branches/debian/wheezy/calibre/wheezy

« back to all changes in this revision

Viewing changes to src/calibre/web/feeds/recipes/recipe_la_tercera.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-09-18 01:18:18 UTC
  • mto: (29.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20090918011818-2whiyzgvx59c7b7t
Tags: upstream-0.6.12+dfsg
ImportĀ upstreamĀ versionĀ 0.6.12+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env  python
2
 
 
3
 
__license__   = 'GPL v3'
4
 
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
5
 
'''
6
 
latercera.com
7
 
'''
8
 
 
 
1
#!/usr/bin/env  python
 
2
 
 
3
__license__   = 'GPL v3'
 
4
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
 
5
'''
 
6
latercera.com
 
7
'''
 
8
 
9
9
from calibre.web.feeds.news import BasicNewsRecipe
10
10
 
11
 
class LaTercera(BasicNewsRecipe):
12
 
    title                 = 'La Tercera'
13
 
    __author__            = 'Darko Miletic'
14
 
    description           = 'El sitio de noticias online de Chile'
15
 
    publisher             = 'La Tercera'
16
 
    category              = 'news, politics, Chile'
17
 
    oldest_article        = 2
18
 
    max_articles_per_feed = 100
19
 
    no_stylesheets        = True
20
 
    encoding              = 'cp1252'
21
 
    remove_javascript     = True
22
 
    use_embedded_content  = False
23
 
    
24
 
    html2lrf_options = [
 
11
class LaTercera(BasicNewsRecipe):
 
12
    title                 = 'La Tercera'
 
13
    __author__            = 'Darko Miletic'
 
14
    description           = 'El sitio de noticias online de Chile'
 
15
    publisher             = 'La Tercera'
 
16
    category              = 'news, politics, Chile'
 
17
    oldest_article        = 2
 
18
    max_articles_per_feed = 100
 
19
    no_stylesheets        = True
 
20
    encoding              = 'cp1252'
 
21
    remove_javascript     = True
 
22
    use_embedded_content  = False
 
23
 
 
24
    html2lrf_options = [
25
25
                          '--comment', description
26
 
                        , '--category', category
27
 
                        , '--publisher', publisher
28
 
                        ]
29
 
    
30
 
    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' 
31
 
                        
32
 
    keep_only_tags = [dict(name='div', attrs={'class':['span-16 articulo border','span-16 border','span-16']}) ]
33
 
 
34
 
    remove_tags = [  
35
 
                     dict(name='script')
36
 
                    ,dict(name='ul')
37
 
                    ,dict(name='div', attrs={'id':['boxComentarios','shim','enviarAmigo']})
38
 
                    ,dict(name='div', attrs={'class':['ad640','span-10 imgSet A','infoRelCol']})
39
 
                    ,dict(name='input')
40
 
                    ,dict(name='p', attrs={'id':['mensajeError','mensajeEnviandoNoticia','mensajeExito']})
41
 
                  ]
42
 
 
43
 
    
44
 
    feeds = [ 
45
 
               (u'Noticias de ultima hora', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&ul=1')
46
 
              ,(u'Pais', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=654')
47
 
              ,(u'Mundo', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=678')
48
 
              ,(u'Deportes', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=656')
49
 
              ,(u'Negocios', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=655')
50
 
              ,(u'Entretenimiento', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=661')
51
 
              ,(u'Motores', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=665')
52
 
              ,(u'Tendencias', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=659')
53
 
              ,(u'Estilo', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=660')
54
 
              ,(u'Educacion', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=657')
55
 
            ]
56
 
 
57
 
    def preprocess_html(self, soup):
58
 
        mtag = '<meta http-equiv="Content-Language" content="es-CL"/>'
59
 
        soup.head.insert(0,mtag)    
60
 
        for item in soup.findAll(style=True):
61
 
            del item['style']
62
 
        return soup
63
 
    
64
 
    language = _('Spanish')
 
 
b'\\ No newline at end of file'
 
26
                        , '--category', category
 
27
                        , '--publisher', publisher
 
28
                        ]
 
29
 
 
30
    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
 
31
 
 
32
    keep_only_tags = [dict(name='div', attrs={'class':['span-16 articulo border','span-16 border','span-16']}) ]
 
33
 
 
34
    remove_tags = [
 
35
                     dict(name='script')
 
36
                    ,dict(name='ul')
 
37
                    ,dict(name='div', attrs={'id':['boxComentarios','shim','enviarAmigo']})
 
38
                    ,dict(name='div', attrs={'class':['ad640','span-10 imgSet A','infoRelCol']})
 
39
                    ,dict(name='input')
 
40
                    ,dict(name='p', attrs={'id':['mensajeError','mensajeEnviandoNoticia','mensajeExito']})
 
41
                  ]
 
42
 
 
43
 
 
44
    feeds = [
 
45
               (u'Noticias de ultima hora', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&ul=1')
 
46
              ,(u'Pais', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=654')
 
47
              ,(u'Mundo', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=678')
 
48
              ,(u'Deportes', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=656')
 
49
              ,(u'Negocios', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=655')
 
50
              ,(u'Entretenimiento', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=661')
 
51
              ,(u'Motores', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=665')
 
52
              ,(u'Tendencias', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=659')
 
53
              ,(u'Estilo', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=660')
 
54
              ,(u'Educacion', u'http://www.latercera.com/app/rss?sc=TEFURVJDRVJB&category=657')
 
55
            ]
 
56
 
 
57
    def preprocess_html(self, soup):
 
58
        mtag = '<meta http-equiv="Content-Language" content="es-CL"/>'
 
59
        soup.head.insert(0,mtag)
 
60
        for item in soup.findAll(style=True):
 
61
            del item['style']
 
62
        return soup
 
63
 
 
64
    language = 'es'