mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #7180 (Fox news website changed)
This commit is contained in:
parent
6dce871b05
commit
eafc6e72c1
@ -4,7 +4,6 @@ __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
|
|||||||
foxnews.com
|
foxnews.com
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class FoxNews(BasicNewsRecipe):
|
class FoxNews(BasicNewsRecipe):
|
||||||
@ -21,11 +20,10 @@ class FoxNews(BasicNewsRecipe):
|
|||||||
language = 'en'
|
language = 'en'
|
||||||
publication_type = 'newsportal'
|
publication_type = 'newsportal'
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
extra_css = ' body{font-family: Arial,sans-serif } img{margin-bottom: 0.4em} .caption{font-size: x-small} '
|
extra_css = """
|
||||||
|
body{font-family: Arial,sans-serif }
|
||||||
preprocess_regexps = [
|
.caption{font-size: x-small}
|
||||||
(re.compile(r'</title>.*?</head>', re.DOTALL|re.IGNORECASE),lambda match: '</title></head>')
|
"""
|
||||||
]
|
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
'comment' : description
|
'comment' : description
|
||||||
@ -34,27 +32,15 @@ class FoxNews(BasicNewsRecipe):
|
|||||||
, 'language' : language
|
, 'language' : language
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_attributes = ['xmlns']
|
remove_attributes = ['xmlns','lang']
|
||||||
|
|
||||||
keep_only_tags = [
|
|
||||||
dict(name='div', attrs={'id' :['story','browse-story-content']})
|
|
||||||
,dict(name='div', attrs={'class':['posts articles','slideshow']})
|
|
||||||
,dict(name='h4' , attrs={'class':'storyDate'})
|
|
||||||
,dict(name='h1' , attrs={'xmlns:functx':'http://www.functx.com'})
|
|
||||||
,dict(name='div', attrs={'class':'authInfo'})
|
|
||||||
,dict(name='div', attrs={'id':'articleCont'})
|
|
||||||
]
|
|
||||||
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name='div', attrs={'class':['share-links','quigo quigo2','share-text','storyControls','socShare','btm-links']})
|
dict(name=['object','embed','link','script','iframe','meta','base'])
|
||||||
,dict(name='div', attrs={'id' :['otherMedia','loomia_display','img-all-path','story-vcmId','story-url','pane-browse-story-comments','story_related']})
|
,dict(attrs={'class':['user-control','url-description','ad-context']})
|
||||||
,dict(name='ul' , attrs={'class':['tools','tools alt','tools alt2','tabs']})
|
|
||||||
,dict(name='a' , attrs={'class':'join-discussion'})
|
|
||||||
,dict(name='ul' , attrs={'class':['tools','tools alt','tools alt2']})
|
|
||||||
,dict(name='p' , attrs={'class':'see_fullarchive'})
|
|
||||||
,dict(name=['object','embed','link','script'])
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
remove_tags_before=dict(name='h1')
|
||||||
|
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' )
|
||||||
@ -67,8 +53,5 @@ class FoxNews(BasicNewsRecipe):
|
|||||||
,(u'Entertainment' , u'http://feeds.foxnews.com/foxnews/entertainment' )
|
,(u'Entertainment' , u'http://feeds.foxnews.com/foxnews/entertainment' )
|
||||||
]
|
]
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def print_version(self, url):
|
||||||
for item in soup.findAll(style=True):
|
return url + 'print'
|
||||||
del item['style']
|
|
||||||
return self.adeify_images(soup)
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user