Fix #6255 (BBC News feeds are blank)

This commit is contained in:
Kovid Goyal 2010-07-22 16:23:39 -06:00
parent 9bb0e21d04
commit b534e2ba0a
2 changed files with 18 additions and 19 deletions

View File

@ -3,14 +3,13 @@ __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
''' '''
news.bbc.co.uk news.bbc.co.uk
''' '''
import re import re
from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.web.feeds.recipes import BasicNewsRecipe
class BBC(BasicNewsRecipe): class BBC(BasicNewsRecipe):
title = 'The BBC' title = 'BBC News'
__author__ = 'Darko Miletic' __author__ = 'Darko Miletic, Starson17'
description = 'Global news and current affairs from the British Broadcasting Corporation' description = 'News from UK. A much faster version that does not download pictures'
oldest_article = 2 oldest_article = 2
max_articles_per_feed = 100 max_articles_per_feed = 100
no_stylesheets = True no_stylesheets = True
@ -23,7 +22,6 @@ class BBC(BasicNewsRecipe):
publication_type = 'newsportal' publication_type = 'newsportal'
extra_css = ' body{ font-family: Verdana,Helvetica,Arial,sans-serif } .introduction{font-weight: bold} .story-feature{display: block; padding: 0; border: 1px solid; width: 40%; font-size: small} .story-feature h2{text-align: center; text-transform: uppercase} ' extra_css = ' body{ font-family: Verdana,Helvetica,Arial,sans-serif } .introduction{font-weight: bold} .story-feature{display: block; padding: 0; border: 1px solid; width: 40%; font-size: small} .story-feature h2{text-align: center; text-transform: uppercase} '
preprocess_regexps = [(re.compile(r'<!--.*?-->', re.DOTALL), lambda m: '')] preprocess_regexps = [(re.compile(r'<!--.*?-->', re.DOTALL), lambda m: '')]
conversion_options = { conversion_options = {
'comments' : description 'comments' : description
,'tags' : category ,'tags' : category
@ -33,14 +31,14 @@ class BBC(BasicNewsRecipe):
} }
keep_only_tags = [ keep_only_tags = [
dict(attrs={'id' :['meta-information','story-body']}) dict(name='div', attrs={'class':['story-body']})
,dict(attrs={'class':['mxb' ,'storybody' ]})
] ]
remove_tags = [ remove_tags = [
dict(name=['object','link','table']) dict(name='div', attrs={'class':['story-feature related narrow', 'share-help', 'embedded-hyper', \
,dict(attrs={'class':['caption','caption full-width','story-actions','hidden','sharesb','audioInStoryC']}) 'story-feature wide ', 'story-feature narrow']})
] ]
remove_tags_after = dict(attrs={'class':'sharesb'})
remove_attributes = ['width','height'] remove_attributes = ['width','height']
feeds = [ feeds = [
@ -59,3 +57,4 @@ class BBC(BasicNewsRecipe):
('Africa', 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/africa/rss.xml'), ('Africa', 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/africa/rss.xml'),
] ]

View File

@ -8,7 +8,7 @@ from calibre.web.feeds.recipes import BasicNewsRecipe
class BBC(BasicNewsRecipe): class BBC(BasicNewsRecipe):
title = 'BBC News (fast)' title = 'BBC News (fast)'
__author__ = 'Darko Miletic' __author__ = 'Darko Miletic, Starson17'
description = 'News from UK. A much faster version that does not download pictures' description = 'News from UK. A much faster version that does not download pictures'
oldest_article = 2 oldest_article = 2
max_articles_per_feed = 100 max_articles_per_feed = 100
@ -31,14 +31,15 @@ class BBC(BasicNewsRecipe):
} }
keep_only_tags = [ keep_only_tags = [
dict(attrs={'id' :['meta-information','story-body']}) dict(name='div', attrs={'class':['story-body']})
,dict(attrs={'class':['mxb' ,'storybody' ]})
] ]
remove_tags = [ remove_tags = [
dict(name=['object','link','table','img']) dict(name='div', attrs={'class':['story-feature related narrow', 'share-help', 'embedded-hyper', \
,dict(attrs={'class':['caption','caption full-width','story-actions','hidden','sharesb','audioInStoryC']}) 'story-feature wide ', 'story-feature narrow']})
, dict(name=['img'])
] ]
remove_tags_after = dict(attrs={'class':'sharesb'})
remove_attributes = ['width','height'] remove_attributes = ['width','height']
feeds = [ feeds = [
@ -56,4 +57,3 @@ class BBC(BasicNewsRecipe):
('Asia-Pacific', 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/asia-pacific/rss.xml'), ('Asia-Pacific', 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/asia-pacific/rss.xml'),
('Africa', 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/africa/rss.xml'), ('Africa', 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/africa/rss.xml'),
] ]