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

« back to all changes in this revision

Viewing changes to src/calibre/web/feeds/recipes/recipe_lanacion_chile.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
 
lanacion.cl
7
 
'''
8
 
import urllib
9
 
 
 
1
#!/usr/bin/env  python
 
2
 
 
3
__license__   = 'GPL v3'
 
4
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
 
5
'''
 
6
lanacion.cl
 
7
'''
 
8
import urllib
 
9
 
10
10
from calibre.web.feeds.news import BasicNewsRecipe
11
11
 
12
 
class LaNacionChile(BasicNewsRecipe):
13
 
    title                 = 'La Nacion Chile'
14
 
    __author__            = 'Darko Miletic'
15
 
    description           = 'El sitio de noticias online de Chile'
16
 
    publisher             = 'La Nacion'
17
 
    category              = 'news, politics, Chile'
18
 
    oldest_article        = 2
19
 
    max_articles_per_feed = 100
20
 
    no_stylesheets        = True
21
 
    use_embedded_content  = False
22
 
    encoding              = 'cp1252'
23
 
    cover_url             = 'http://www.lanacion.cl/prontus_noticias_v2/imag/site/logo.gif'
24
 
    remove_javascript     = True
25
 
    
26
 
    html2lrf_options = [
 
12
class LaNacionChile(BasicNewsRecipe):
 
13
    title                 = 'La Nacion Chile'
 
14
    __author__            = 'Darko Miletic'
 
15
    description           = 'El sitio de noticias online de Chile'
 
16
    publisher             = 'La Nacion'
 
17
    category              = 'news, politics, Chile'
 
18
    oldest_article        = 2
 
19
    max_articles_per_feed = 100
 
20
    no_stylesheets        = True
 
21
    use_embedded_content  = False
 
22
    encoding              = 'cp1252'
 
23
    cover_url             = 'http://www.lanacion.cl/prontus_noticias_v2/imag/site/logo.gif'
 
24
    remove_javascript     = True
 
25
 
 
26
    html2lrf_options = [
27
27
                          '--comment', description
28
 
                        , '--category', category
29
 
                        , '--publisher', publisher
30
 
                        ]
31
 
    
32
 
    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' 
33
 
                        
34
 
    keep_only_tags = [dict(name='div', attrs={'class':'bloque'})]
35
 
                        
36
 
    feeds = [(u'Noticias', u'http://www.lanacion.cl/rss.xml')]
37
 
 
38
 
    def print_version(self, url):
39
 
        toprint = urllib.quote(url,':/')
40
 
        return u'http://www.lanacion.cl/cgi-bx/imprimir.cgi?_URL=' + toprint
41
 
 
42
 
    def preprocess_html(self, soup):
43
 
        del soup.body['onload']
44
 
        soup.head.base.extract()
45
 
        item = soup.find('a', attrs={'href':'javascript:window.close()'})
46
 
        if item:
47
 
           item.extract()
48
 
        mtag = '<meta http-equiv="Content-Language" content="es-CL"/>'
49
 
        soup.head.insert(0,mtag)    
50
 
        for item in soup.findAll(style=True):
51
 
            del item['style']           
52
 
        return soup
53
 
    
54
 
    language = _('Spanish')
 
 
b'\\ No newline at end of file'
 
28
                        , '--category', category
 
29
                        , '--publisher', publisher
 
30
                        ]
 
31
 
 
32
    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
 
33
 
 
34
    keep_only_tags = [dict(name='div', attrs={'class':'bloque'})]
 
35
 
 
36
    feeds = [(u'Noticias', u'http://www.lanacion.cl/rss.xml')]
 
37
 
 
38
    def print_version(self, url):
 
39
        toprint = urllib.quote(url,':/')
 
40
        return u'http://www.lanacion.cl/cgi-bx/imprimir.cgi?_URL=' + toprint
 
41
 
 
42
    def preprocess_html(self, soup):
 
43
        del soup.body['onload']
 
44
        soup.head.base.extract()
 
45
        item = soup.find('a', attrs={'href':'javascript:window.close()'})
 
46
        if item:
 
47
           item.extract()
 
48
        mtag = '<meta http-equiv="Content-Language" content="es-CL"/>'
 
49
        soup.head.insert(0,mtag)
 
50
        for item in soup.findAll(style=True):
 
51
            del item['style']
 
52
        return soup
 
53
 
 
54
    language = 'es'