~ubuntu-branches/debian/experimental/calibre/experimental

« back to all changes in this revision

Viewing changes to recipes/smashing.recipe

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2012-08-16 09:55:40 UTC
  • mfrom: (1.3.35)
  • Revision ID: package-import@ubuntu.com-20120816095540-yfaxheew17jv19l5
Tags: 0.8.64+dfsg-1
* New upstream release:
  - Update license of the quick start guide to be DFSG compatible. Thanks to
    Christophe Siraut for sorting this out! (Closes: #653328)
* debian/control: Add new libmtp-dev build dependency.
* debian/control: Stricter python-mechanize dependency. (Closes: #684616)

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.smashingmagazine.com
7
 
'''
8
 
 
 
1
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
9
2
from calibre.web.feeds.news import BasicNewsRecipe
10
3
 
11
 
class SmashingMagazine(BasicNewsRecipe):
12
 
    title                 = 'Smashing Magazine'
13
 
    __author__            = 'Darko Miletic'
14
 
    description           = 'We smash you with the information that will make your life easier, really'
15
 
    oldest_article        = 20
16
 
    language              = 'en'
17
 
    max_articles_per_feed = 100
18
 
    no_stylesheets        = True
19
 
    use_embedded_content  = False
20
 
    publisher             = 'Smashing Magazine'
21
 
    category              = 'news, web, IT, css, javascript, html'
22
 
    encoding              = 'utf-8'
23
 
 
24
 
    conversion_options = {
25
 
                             'comments'    : description
26
 
                            ,'tags'        : category
27
 
                            ,'publisher'   : publisher
28
 
                         }
29
 
 
30
 
    keep_only_tags = [dict(name='div', attrs={'id':'leftcolumn'})]
31
 
    remove_tags_after = dict(name='ul',attrs={'class':'social'})
32
 
    remove_tags = [
33
 
                    dict(name=['link','object'])
34
 
                   ,dict(name='h1',attrs={'class':'logo'})
35
 
                   ,dict(name='div',attrs={'id':'booklogosec'})
36
 
                   ,dict(attrs={'src':'http://media2.smashingmagazine.com/wp-content/uploads/images/the-smashing-book/smbook6.gif'})
37
 
                  ]
38
 
 
39
 
    feeds          = [(u'Articles', u'http://rss1.smashingmagazine.com/feed/')]
40
 
 
41
 
    def preprocess_html(self, soup):
42
 
        for iter in soup.findAll('div',attrs={'class':'leftframe'}):
43
 
            it = iter.find('h1')
44
 
            if it == None:
45
 
               iter.extract()
46
 
        for item in soup.findAll('img'):
47
 
            oldParent = item.parent
48
 
            if oldParent.name == 'a':
49
 
               oldParent.name = 'div'
50
 
        return soup
 
4
class SmashingMagazine (BasicNewsRecipe):
 
5
   __author__ = u'Marc Busqué <marc@lamarciana.com>'
 
6
   __url__ = 'http://www.lamarciana.com'
 
7
   __version__ = '1.0.1'
 
8
   __license__   = 'GPL v3'
 
9
   __copyright__ = u'2012, Marc Busqué <marc@lamarciana.com>'
 
10
   title = u'Smashing Magazine'
 
11
   description = u'Founded in September 2006, Smashing Magazine delivers useful and innovative information to Web designers and developers. Our aim is to inform our readers about the latest trends and techniques in Web development. We try to persuade you not with the quantity but with the quality of the information we present. Smashing Magazine is and always has been independent.'
 
12
   language = 'en'
 
13
   tags = 'web development, software'
 
14
   oldest_article = 7
 
15
   remove_empty_feeds = True
 
16
   no_stylesheets = True
 
17
   encoding = 'utf8'
 
18
   cover_url = u'http://media.smashingmagazine.com/themes/smashingv4/images/logo.png'
 
19
   remove_attributes = ['border', 'cellspacing', 'align', 'cellpadding', 'colspan', 'valign', 'vspace', 'hspace', 'alt', 'width', 'height', 'style']
 
20
   extra_css = u'body div table:first-child {display: none;} img {max-width: 100%; display: block; margin: auto;}'
 
21
 
 
22
   feeds = [
 
23
         (u'Smashing Magazine', u'http://rss1.smashingmagazine.com/feed/'),
 
24
         ]