mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix Big Oven
This commit is contained in:
parent
7736144410
commit
96ab5a8c12
@ -36,29 +36,38 @@ class BigOven(BasicNewsRecipe):
|
|||||||
|
|
||||||
remove_attributes = ['style', 'font']
|
remove_attributes = ['style', 'font']
|
||||||
|
|
||||||
remove_tags = [dict(name='div', attrs={'class':['ppy-caption']})
|
def get_article_url(self, article):
|
||||||
,dict(name='div', attrs={'id':['float_corner']})
|
url = article.get('feedburner_origlink',article.get('link', None))
|
||||||
]
|
front, middle, end = url.partition('comhttp//www.bigoven.com')
|
||||||
|
url = front + 'com' + end
|
||||||
|
return url
|
||||||
|
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'id':['nosidebar_main']})]
|
||||||
|
|
||||||
|
remove_tags_after = [dict(name='div', attrs={'class':['display-field']})]
|
||||||
|
|
||||||
|
remove_tags = [dict(name='ul', attrs={'class':['tabs']})]
|
||||||
|
|
||||||
|
preprocess_regexps = [
|
||||||
|
(re.compile(r'Want detailed nutrition information?', re.DOTALL), lambda match: ''),
|
||||||
|
(re.compile('\(You could win \$100 in our ', re.DOTALL), lambda match: ''),
|
||||||
|
]
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
for tag in soup.findAll(name='a', attrs={'class':['deflink']}):
|
|
||||||
tag.replaceWith(tag.string)
|
|
||||||
for tag in soup.findAll(name='a', text=re.compile(r'.*View Metric.*', re.DOTALL)):
|
for tag in soup.findAll(name='a', text=re.compile(r'.*View Metric.*', re.DOTALL)):
|
||||||
tag.parent.parent.extract()
|
tag.parent.parent.extract()
|
||||||
for tag in soup.findAll(name='a', text=re.compile(r'.*Add my own photo.*', re.DOTALL)):
|
for tag in soup.findAll(text=re.compile(r'.*Try BigOven Pro for Free.*', re.DOTALL)):
|
||||||
tag.parent.parent.extract()
|
tag.extract()
|
||||||
for tag in soup.findAll(name='div', attrs={'class':['container']}):
|
for tag in soup.findAll(text=re.compile(r'.*Add my photo of this recipe.*', re.DOTALL)):
|
||||||
if tag.find(name='h1'):
|
tag.parent.extract()
|
||||||
continue
|
for tag in soup.findAll(name='a', text=re.compile(r'.*photo contest.*', re.DOTALL)):
|
||||||
if tag.find(name='h2', text=re.compile(r'.*Ingredients.*', re.DOTALL)):
|
tag.parent.extract()
|
||||||
print 'tag found Ingred h2'
|
for tag in soup.findAll(name='a', text='Remove ads'):
|
||||||
continue
|
tag.parent.parent.extract()
|
||||||
if tag.find(name='h2', text=re.compile(r'Preparation.*', re.DOTALL)):
|
for tag in soup.findAll(name='ol', attrs={'class':['recipe-tags']}):
|
||||||
print 'tag found Prep h2'
|
tag.parent.extract()
|
||||||
continue
|
|
||||||
tag.extract()
|
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
feeds = [(u'4 & 5 Star Rated Recipes', u'http://feeds.feedburner.com/Bigovencom-RecipeRaves?format=xml')]
|
feeds = [(u'Recent Raves', u'http://www.bigoven.com/rss/recentraves'),
|
||||||
|
(u'Recipe Of The Day', u'http://feeds.feedburner.com/bigovencom-RecipeOfTheDay')]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user