~stub/ubuntu/precise/calibre/devel

« back to all changes in this revision

Viewing changes to resources/recipes/bighollywood.recipe

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-04-12 11:29:25 UTC
  • mfrom: (42.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110412112925-c7171kt2bb5rmft4
Tags: 0.7.50+dfsg-2
* debian/control: Build with libpodofo-dev to enable PDF metadata.
  (Closes: #619632)
* debian/control: Add libboost1.42-dev build dependency. Apparently it is
  needed in some setups. (Closes: #619807)
* debian/rules: Call dh_sip to generate a proper sip API dependency, to
  prevent crashes like #616372 for partial upgrades.
* debian/control: Bump python-qt4 dependency to >= 4.8.3-2, which reportedly
  fixes crashes on startup. (Closes: #619701, #620125)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
__license__   = 'GPL v3'
 
2
__copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
 
3
'''
 
4
bighollywood.breitbart.com
 
5
'''
 
6
 
 
7
from calibre.web.feeds.news import BasicNewsRecipe
 
8
 
 
9
class BigHollywood(BasicNewsRecipe):
 
10
    title                 = 'Big Hollywood'
 
11
    __author__            = 'Darko Miletic'
 
12
    description           = 'News and articles from the media world'
 
13
    publisher             = 'Big Hollywood'
 
14
    category              = 'news, media, art, literature, movies, politics, USA, Hollywood'
 
15
    oldest_article        = 7
 
16
    max_articles_per_feed = 200
 
17
    no_stylesheets        = True
 
18
    encoding              = 'utf8'
 
19
    use_embedded_content  = False
 
20
    language              = 'en'
 
21
    remove_empty_feeds    = True
 
22
    publication_type      = 'blog'
 
23
    extra_css             = """
 
24
                               body{font-family: Arial,sans-serif }
 
25
                            """
 
26
 
 
27
    conversion_options = {
 
28
                          'comment'   : description
 
29
                        , 'tags'      : category
 
30
                        , 'publisher' : publisher
 
31
                        , 'language'  : language
 
32
                        }
 
33
 
 
34
    keep_only_tags=[dict(attrs={'class':'postcontent'})]
 
35
    remove_tags = [
 
36
                     dict(name=['meta','link','link','iframe','embed','object'])
 
37
                    ,dict(name='p', attrs={'class':['post_meta_links','postfooter']})
 
38
                  ]
 
39
    remove_attributes=['original','onclick']
 
40
 
 
41
    feeds = [(u'Articles', u'http://bighollywood.breitbart.com/feed/')]
 
42
 
 
43
    def preprocess_html(self, soup):
 
44
        for item in soup.findAll(style=True):
 
45
            del item['style']
 
46
        for item in soup.findAll('a'):
 
47
            limg = item.find('img')
 
48
            if item.string is not None:
 
49
               str = item.string
 
50
               item.replaceWith(str)
 
51
            else:
 
52
               if limg:
 
53
                  if limg['src'].endswith('BlogPrintButton.png'):
 
54
                     limg.extract()
 
55
                  item.name = 'div'
 
56
                  item.attrs = []
 
57
               else:
 
58
                   str = self.tag_to_string(item)
 
59
                   item.replaceWith(str)
 
60
        for item in soup.findAll('img'):
 
61
            if not item.has_key('alt'):
 
62
               item['alt'] = 'image'
 
63
        return soup