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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-09-18 01:18:18 UTC
  • mfrom: (1.3.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090918011818-1rdnzf42tgkmmmdn
Tags: 0.6.12+dfsg-0ubuntu1
* New upstream bug fix release.
* debian/rules: Update get-orig-source for new upstream source layout.
* Drop recipe_zeitde_moresections.patch: Applied upstream.
* Add fix-setup.py-install-root.patch: Fix setup.py install --root option to
  do what --root should do.
* Add disable-podofo-extension.patch: Disable podofo extension, podofo is
  not yet packaged.
* debian/rules: Replace copy of Liberation TTFs with symlink to
  ttf-liberation files.
* debian/rules: Remove unnecessary executable permissions from libraries in
  /usr/lib/calibre/.
* debian/control: Set Vcs-Bzr: for Ubuntu branch.
* Add fix_recipe_zeitde.patch: Fix recipe for "Die Zeit", zeit.de recently
  reorganized their web pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env  python
2
 
 
3
 
__license__   = 'GPL v3'
4
 
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
5
 
'''
6
 
telegraph.co.uk
7
 
'''
8
 
 
9
 
from calibre.web.feeds.news import BasicNewsRecipe
10
 
 
11
 
class TelegraphUK(BasicNewsRecipe):
12
 
    title                 = u'Telegraph.co.uk'
13
 
    __author__            = 'Darko Miletic'
14
 
    description           = 'News from United Kingdom'    
15
 
    oldest_article        = 7
16
 
    max_articles_per_feed = 100
17
 
    no_stylesheets        = True
18
 
    language = _('English')
19
 
    use_embedded_content  = False
20
 
 
21
 
    keep_only_tags    = [ 
22
 
                           dict(name='div', attrs={'class':'storyHead'})
23
 
                          ,dict(name='div', attrs={'class':'story'    }) 
24
 
                        ]
25
 
    remove_tags    = [dict(name='div', attrs={'class':'slideshow'})]
26
 
    
27
 
    feeds          = [
28
 
                         (u'UK News'        , u'http://www.telegraph.co.uk/news/uknews/rss'                                      )
29
 
                        ,(u'World News'     , u'http://www.telegraph.co.uk/news/worldnews/rss'                                   )
30
 
                        ,(u'Politics'       , u'http://www.telegraph.co.uk/news/newstopics/politics/rss'                         )
31
 
                        ,(u'Technology News', u'http://www.telegraph.co.uk/scienceandtechnology/technology/technologynews/rss'   )
32
 
                        ,(u'UK News'        , u'http://www.telegraph.co.uk/scienceandtechnology/technology/technologyreviews/rss')
33
 
                        ,(u'Science News'   , u'http://www.telegraph.co.uk/scienceandtechnology/science/sciencenews/rss'         )
34
 
                        ,(u'Sport'          , u'http://www.telegraph.co.uk/sport/rss'                                            )
35
 
                        ,(u'Earth News'     , u'http://www.telegraph.co.uk/earth/earthnews/rss'                                  )
36
 
                        ,(u'Comment'        , u'http://www.telegraph.co.uk/comment/rss'                                          )
37
 
                        ,(u'How about that?', u'http://www.telegraph.co.uk/news/newstopics/howaboutthat/rss'                     )
38
 
                     ]
 
1
#!/usr/bin/env  python
 
2
__license__   = 'GPL v3'
 
3
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
 
4
'''
 
5
telegraph.co.uk
 
6
'''
 
7
 
 
8
from calibre.web.feeds.news import BasicNewsRecipe
 
9
 
 
10
class TelegraphUK(BasicNewsRecipe):
 
11
    title                 = u'Telegraph.co.uk'
 
12
    __author__            = 'Darko Miletic'
 
13
    description           = 'News from United Kingdom'    
 
14
    oldest_article        = 7
 
15
    max_articles_per_feed = 100
 
16
    no_stylesheets        = True
 
17
    language = 'en'
 
18
 
 
19
    use_embedded_content  = False
 
20
 
 
21
    extra_css = '''
 
22
                h1{font-family :Arial,Helvetica,sans-serif; font-size:large; }
 
23
                h2{font-family :Arial,Helvetica,sans-serif; font-size:x-small; color:#444444}
 
24
                .story{font-family :Arial,Helvetica,sans-serif; font-size: x-small;}
 
25
                .byline{color:#666666; font-family :Arial,Helvetica,sans-serif; font-size: xx-small;}
 
26
                a{color:#234B7B; }
 
27
                .imageExtras{color:#666666; font-family :Arial,Helvetica,sans-serif; font-size: xx-small;}
 
28
                '''
 
29
    
 
30
    keep_only_tags    = [ 
 
31
                           dict(name='div', attrs={'class':'storyHead'})
 
32
                          ,dict(name='div', attrs={'class':'story'    })
 
33
                          #,dict(name='div', attrs={'class':['slideshowHD gutterUnder',"twoThirds gutter","caption" ]   }) 
 
34
                        ]
 
35
    remove_tags    = [dict(name='div', attrs={'class':['related_links_inline',"imgindex","next","prev","gutterUnder"]})]
 
36
    
 
37
    feeds          = [
 
38
                         (u'UK News'        , u'http://www.telegraph.co.uk/news/uknews/rss'                                      )
 
39
                        ,(u'World News'     , u'http://www.telegraph.co.uk/news/worldnews/rss'                                   )
 
40
                        ,(u'Politics'       , u'http://www.telegraph.co.uk/news/newstopics/politics/rss'                         )
 
41
                        ,(u'Technology News', u'http://www.telegraph.co.uk/scienceandtechnology/technology/technologynews/rss'   )
 
42
                        ,(u'UK News'        , u'http://www.telegraph.co.uk/scienceandtechnology/technology/technologyreviews/rss')
 
43
                        ,(u'Science News'   , u'http://www.telegraph.co.uk/scienceandtechnology/science/sciencenews/rss'         )
 
44
                        ,(u'Sport'          , u'http://www.telegraph.co.uk/sport/rss'                                            )
 
45
                        ,(u'Earth News'     , u'http://www.telegraph.co.uk/earth/earthnews/rss'                                  )
 
46
                        ,(u'Comment'        , u'http://www.telegraph.co.uk/comment/rss'                                          )
 
47
                        ,(u'How about that?', u'http://www.telegraph.co.uk/news/newstopics/howaboutthat/rss'                     )
 
48
                     ]
 
49
 
 
50
    def get_article_url(self, article):
 
51
        
 
52
        url = article.get('guid', None)
 
53
        
 
54
        if 'picture-galleries' in url or 'pictures' in url or 'picturegalleries' in url :
 
55
            url = None
 
56
        
 
57
        return url
 
58
 
 
59