~ubuntu-branches/ubuntu/karmic/calibre/karmic

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-30 12:49:41 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730124941-qjdsmri25zt8zocn
Tags: 0.6.3+dfsg-0ubuntu1
* New upstream release. Please see http://calibre.kovidgoyal.net/new_in_6/
  for the list of new features and changes.
* remove_postinstall.patch: Update for new version.
* build_debug.patch: Does not apply any more, disable for now. Might not be
  necessary any more.
* debian/copyright: Fix reference to versionless GPL.
* debian/rules: Drop obsolete dh_desktop call.
* debian/rules: Add workaround for weird Python 2.6 setuptools behaviour of
  putting compiled .so files into src/calibre/plugins/calibre/plugins
  instead of src/calibre/plugins.
* debian/rules: Drop hal fdi moving, new upstream version does not use hal
  any more. Drop hal dependency, too.
* debian/rules: Install udev rules into /lib/udev/rules.d.
* Add debian/calibre.preinst: Remove unmodified
  /etc/udev/rules.d/95-calibre.rules on upgrade.
* debian/control: Bump Python dependencies to 2.6, since upstream needs
  it now.

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
www.laprensahn.com
 
7
'''
 
8
 
 
9
from calibre.web.feeds.news import BasicNewsRecipe
 
10
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
 
11
 
 
12
class LaPrensaHn(BasicNewsRecipe):
 
13
    title                 = 'La Prensa - Honduras'
 
14
    __author__            = 'Darko Miletic'
 
15
    description           = 'Noticias de Honduras y mundo'
 
16
    publisher             = 'La Prensa'
 
17
    category              = 'news, politics, Honduras'
 
18
    oldest_article        = 2
 
19
    max_articles_per_feed = 100
 
20
    use_embedded_content  = False
 
21
    no_stylesheets        = True
 
22
    remove_javascript     = True
 
23
    encoding              = 'utf-8'
 
24
    language              = _('Spanish')
 
25
    lang                  = 'es-HN'
 
26
    direction             = 'ltr'
 
27
    
 
28
    html2lrf_options = [
 
29
                          '--comment', description
 
30
                        , '--category', category
 
31
                        , '--publisher', publisher
 
32
                        ]
 
33
    
 
34
    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\npretty_print=True\noverride_css=" p {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em} "' 
 
35
 
 
36
    remove_tags = [dict(name=['form','object','embed'])]
 
37
 
 
38
    keep_only_tags = [
 
39
                         dict(name='h1' , attrs={'class':'titulo1'})
 
40
                        ,dict(name='div', attrs={'class':['sumario11','hora','texto']})
 
41
                     ]
 
42
 
 
43
    feeds = [(u'Noticias', u'http://feeds.feedburner.com/laprensa_titulares')]
 
44
 
 
45
    def preprocess_html(self, soup):
 
46
        soup.html['lang'] = self.lang
 
47
        soup.html['dir' ] = self.direction
 
48
        mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
 
49
        mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
 
50
        soup.head.insert(0,mlang)
 
51
        soup.head.insert(1,mcharset)
 
52
        for item in soup.findAll(style=True):
 
53
            del item['style']
 
54
        return soup