Updated recipe for Telegraph UK

This commit is contained in:
Kovid Goyal 2009-09-03 10:32:25 -06:00
parent 1698282f2c
commit 264d032646

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
@ -10,7 +9,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
class TelegraphUK(BasicNewsRecipe):
title = u'Telegraph.co.uk'
__author__ = 'Darko Miletic'
__author__ = 'Darko Miletic and Sujata Raman'
description = 'News from United Kingdom'
oldest_article = 7
max_articles_per_feed = 100
@ -18,11 +17,21 @@ class TelegraphUK(BasicNewsRecipe):
language = _('English')
use_embedded_content = False
extra_css = '''
h1{font-family :Arial,Helvetica,sans-serif; font-size:large; color:#666666}
h2{font-family :Arial,Helvetica,sans-serif; font-size:small; color:#444444}
.story{font-family :Arial,Helvetica,sans-serif; font-size: x-small; color:#444444 }
.byline{color:#666666; font-family :Arial,Helvetica,sans-serif; font-size: xx-small;}
a{color:#234B7B; }
.imageExtras{color:#666666; font-family :Arial,Helvetica,sans-serif; font-size: xx-small;}
'''
keep_only_tags = [
dict(name='div', attrs={'class':'storyHead'})
,dict(name='div', attrs={'class':'story' })
#,dict(name='div', attrs={'class':['slideshowHD gutterUnder',"twoThirds gutter","caption" ] })
]
remove_tags = [dict(name='div', attrs={'class':'slideshow'})]
remove_tags = [dict(name='div', attrs={'class':['related_links_inline',"imgindex","next","prev","gutterUnder"]})]
feeds = [
(u'UK News' , u'http://www.telegraph.co.uk/news/uknews/rss' )
@ -36,3 +45,14 @@ class TelegraphUK(BasicNewsRecipe):
,(u'Comment' , u'http://www.telegraph.co.uk/comment/rss' )
,(u'How about that?', u'http://www.telegraph.co.uk/news/newstopics/howaboutthat/rss' )
]
def get_article_url(self, article):
url = article.get('guid', None)
if 'picture-galleries' in url or 'pictures' in url or 'picturegalleries' in url :
url = None
return url