mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
BuckMasters In The Kitchen by Tony Stegall
This commit is contained in:
parent
547a063f68
commit
9e59f00645
42
resources/recipes/buckmasters.recipe
Normal file
42
resources/recipes/buckmasters.recipe
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
from calibre.ebooks.BeautifulSoup import Tag
|
||||||
|
|
||||||
|
class AdvancedUserRecipe1282101454(BasicNewsRecipe):
|
||||||
|
title = 'BuckMasters In The Kitchen'
|
||||||
|
language = 'en'
|
||||||
|
__author__ = 'TonytheBookworm & Starson17'
|
||||||
|
description = 'Learn how to cook all those outdoor varments'
|
||||||
|
publisher = 'BuckMasters.com'
|
||||||
|
category = 'food,cooking,recipes'
|
||||||
|
oldest_article = 365
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
conversion_options = {'linearize_tables' : True}
|
||||||
|
masthead_url = 'http://www.buckmasters.com/Portals/_default/Skins/BM_10/images/header_bg.jpg'
|
||||||
|
keep_only_tags = [
|
||||||
|
dict(name='table', attrs={'class':['containermaster_black']})
|
||||||
|
]
|
||||||
|
remove_tags_after = [dict(name='div', attrs={'align':['left']})]
|
||||||
|
feeds = [
|
||||||
|
('Recipes', 'http://www.buckmasters.com/DesktopModules/DnnForge%20-%20NewsArticles/RSS.aspx?TabID=292&ModuleID=658&MaxCount=25'),
|
||||||
|
]
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
item = soup.find('a', attrs={'class':['MenuTopSelected']})
|
||||||
|
if item:
|
||||||
|
item.parent.extract()
|
||||||
|
for img_tag in soup.findAll('img'):
|
||||||
|
parent_tag = img_tag.parent
|
||||||
|
if parent_tag.name == 'a':
|
||||||
|
new_tag = Tag(soup,'p')
|
||||||
|
new_tag.insert(0,img_tag)
|
||||||
|
parent_tag.replaceWith(new_tag)
|
||||||
|
elif parent_tag.name == 'p':
|
||||||
|
if not self.tag_to_string(parent_tag) == '':
|
||||||
|
new_div = Tag(soup,'div')
|
||||||
|
new_tag = Tag(soup,'p')
|
||||||
|
new_tag.insert(0,img_tag)
|
||||||
|
parent_tag.replaceWith(new_div)
|
||||||
|
new_div.insert(0,new_tag)
|
||||||
|
new_div.insert(1,parent_tag)
|
||||||
|
return soup
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user