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

« back to all changes in this revision

Viewing changes to src/calibre/web/feeds/recipes/recipe_elperiodico_spanish.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
# -*- coding: utf-8 -*-
 
3
 
 
4
__license__   = 'GPL v3'
 
5
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
 
6
'''
 
7
elperiodico.com
 
8
'''
 
9
 
 
10
from calibre.web.feeds.news import BasicNewsRecipe
 
11
from calibre.ebooks.BeautifulSoup import Tag
 
12
 
 
13
class ElPeriodico_esp(BasicNewsRecipe):
 
14
    title                 = 'El Periodico de Catalunya'
 
15
    __author__            = 'Darko Miletic'
 
16
    description           = 'Noticias desde Catalunya'
 
17
    publisher             = 'elperiodico.com'
 
18
    category              = 'news, politics, Spain, Catalunya'
 
19
    oldest_article        = 2
 
20
    max_articles_per_feed = 100
 
21
    no_stylesheets        = True
 
22
    use_embedded_content  = False
 
23
    delay                 = 1
 
24
    encoding              = 'cp1252'
 
25
    language              = _('Spanish')
 
26
 
 
27
    html2lrf_options = [
 
28
                          '--comment'  , description
 
29
                        , '--category' , category
 
30
                        , '--publisher', publisher
 
31
                        ]
 
32
 
 
33
    html2epub_options  = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
 
34
 
 
35
    feeds              = [(u"Toda la edición", u'http://www.elperiodico.com/rss.asp?id=46')]
 
36
 
 
37
 
 
38
    keep_only_tags = [dict(name='div', attrs={'id':'noticia'})]
 
39
 
 
40
    remove_tags        = [
 
41
                              dict(name=['object','link','script'])
 
42
                             ,dict(name='ul',attrs={'class':'herramientasDeNoticia'})
 
43
                             ,dict(name='div', attrs={'id':'inferiores'})
 
44
                         ]
 
45
 
 
46
    def print_version(self, url):
 
47
        return url.replace('/default.asp?','/print.asp?')
 
48
 
 
49
    def preprocess_html(self, soup):
 
50
        mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
 
51
        soup.head.insert(0,mcharset)
 
52
        for item in soup.findAll(style=True):
 
53
            del item['style']
 
54
        return soup
 
55