mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Fox News
This commit is contained in:
parent
6a0c039d93
commit
debb1a3968
@ -35,14 +35,10 @@ class FoxNews(BasicNewsRecipe):
|
|||||||
|
|
||||||
remove_attributes = ['xmlns','lang']
|
remove_attributes = ['xmlns','lang']
|
||||||
|
|
||||||
remove_tags=[
|
keep_only_tags = [
|
||||||
dict(attrs={'class':['user-control','logo','ad-300x250','url-description']})
|
dict(itemprop=['headline', 'articleBody']),
|
||||||
,dict(name=['meta','base','link','iframe','object','embed'])
|
|
||||||
]
|
]
|
||||||
|
|
||||||
keep_only_tags=[dict(attrs={'id':'article-print'})]
|
|
||||||
remove_tags_after =dict(attrs={'class':'url-description'})
|
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'Latest Headlines', u'http://feeds.foxnews.com/foxnews/latest' )
|
(u'Latest Headlines', u'http://feeds.foxnews.com/foxnews/latest' )
|
||||||
,(u'National' , u'http://feeds.foxnews.com/foxnews/national' )
|
,(u'National' , u'http://feeds.foxnews.com/foxnews/national' )
|
||||||
@ -54,26 +50,3 @@ class FoxNews(BasicNewsRecipe):
|
|||||||
,(u'Entertainment' , u'http://feeds.foxnews.com/foxnews/entertainment' )
|
,(u'Entertainment' , u'http://feeds.foxnews.com/foxnews/entertainment' )
|
||||||
]
|
]
|
||||||
|
|
||||||
def print_version(self, url):
|
|
||||||
return url + 'print'
|
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
|
||||||
for item in soup.findAll(style=True):
|
|
||||||
del item['style']
|
|
||||||
for item in soup.findAll('a'):
|
|
||||||
limg = item.find('img')
|
|
||||||
if item.string is not None:
|
|
||||||
str = item.string
|
|
||||||
item.replaceWith(str)
|
|
||||||
else:
|
|
||||||
if limg:
|
|
||||||
item.name = 'div'
|
|
||||||
item.attrs = []
|
|
||||||
else:
|
|
||||||
str = self.tag_to_string(item)
|
|
||||||
item.replaceWith(str)
|
|
||||||
for item in soup.findAll('img'):
|
|
||||||
if not item.has_key('alt'):
|
|
||||||
item['alt'] = 'image'
|
|
||||||
return soup
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user