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

« back to all changes in this revision

Viewing changes to src/calibre/web/feeds/recipes/recipe_harpers.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:
6
6
harpers.org
7
7
'''
8
8
from calibre.web.feeds.news import BasicNewsRecipe
 
9
from calibre.ebooks.BeautifulSoup import Tag
9
10
 
10
11
class Harpers(BasicNewsRecipe):
11
12
    title                 = u"Harper's Magazine"
18
19
    max_articles_per_feed = 100
19
20
    no_stylesheets        = True
20
21
    use_embedded_content  = False
21
 
    remove_javascript     = True
22
22
 
23
23
    html2lrf_options = [
24
24
                          '--comment', description
25
25
                        , '--category', category
26
26
                        , '--publisher', publisher
27
27
                        ]
28
 
    
29
 
    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0em; margin-top: 0em; margin-bottom: 0.5em} img {margin-top: 0em; margin-bottom: 0.4em}"' 
30
 
    
31
 
    
 
28
 
 
29
    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0em; margin-top: 0em; margin-bottom: 0.5em} img {margin-top: 0em; margin-bottom: 0.4em}"'
 
30
 
 
31
 
32
32
    keep_only_tags = [ dict(name='div', attrs={'id':'cached'}) ]
33
33
    remove_tags = [
34
 
                     dict(name='table', attrs={'class':'rcnt'})
35
 
                    ,dict(name='table', attrs={'class':'rcnt topline'})
 
34
                     dict(name='table', attrs={'class':['rcnt','rcnt topline']})
36
35
                    ,dict(name=['link','object','embed'])
37
36
                  ]
38
37
 
39
38
    feeds       = [(u"Harper's Magazine", u'http://www.harpers.org/rss/frontpage-rss20.xml')]
40
39
 
 
40
    def preprocess_html(self, soup):
 
41
        mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
 
42
        soup.head.insert(1,mcharset)
 
43
        for item in soup.findAll(style=True):
 
44
            del item['style']
 
45
        for item in soup.findAll(xmlns=True):
 
46
            del item['xmlns']
 
47
        return soup
 
48