From 1cc3038f0ed2f5986bd013fcbcc6d7cbd45d76eb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 13 Mar 2011 10:08:38 -0600 Subject: [PATCH] Update Draw And Cook --- resources/images/news/DrawAndCook.png | Bin 0 -> 575 bytes resources/recipes/DrawAndCook.recipe | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 resources/images/news/DrawAndCook.png diff --git a/resources/images/news/DrawAndCook.png b/resources/images/news/DrawAndCook.png new file mode 100644 index 0000000000000000000000000000000000000000..8b40b7534407f55bb439e045effdc557791a81ce GIT binary patch literal 575 zcmV-F0>J%=P)|KG3o-a>;04I2E9@J4sM(FMSsH@X9qz_IL~$+ZBEfHm+4 z3}k%`tdw<+HNn3EJ!M@xv-b%YCvm&)ywSfhaUK#8r@$?+lV|&~-&NM#RWk$b<@S9l z(i?p#N$h|Puu#^mTEGP`1U|?QV5zKYE9(vtlDV?(Kr$$R??RYjnykx;D+Az4Vs@2v zD}a`=ZltVRD(g1MpTA{X0YF(d7gqo-6Osbx0aq1Q&VX}Zt*rZ4jn}H&7joTZxSvId zD|6r^7L$;ZA&IVxatT!h97~X#fI30Z>M^iP_6s?p6N2^Gn0s#^szXPvTOm3EV)i#c zpWlvN*9ECNg1cE*5pRWpe_`>{~A}1rC9cWIvGSp9#*y&e^^e zs4C!9$S^r4oa>5Ed^=z$Ep`e_r5!?y}};Xu;s(cXoS$MYT&=EgD;zeA{pfj4@Z z&JAyL`G)}6+^>+vAP}MBE)=U@d6Sph1IwjVH<+zROZZOUM8K N002ovPDHLkV1im81SkLi literal 0 HcmV?d00001 diff --git a/resources/recipes/DrawAndCook.recipe b/resources/recipes/DrawAndCook.recipe index 1c080b85db..8db4f71014 100644 --- a/resources/recipes/DrawAndCook.recipe +++ b/resources/recipes/DrawAndCook.recipe @@ -1,8 +1,11 @@ from calibre.web.feeds.news import BasicNewsRecipe +import re class DrawAndCook(BasicNewsRecipe): title = 'DrawAndCook' __author__ = 'Starson17' + __version__ = 'v1.10' + __date__ = '13 March 2011' description = 'Drawings of recipes!' language = 'en' publisher = 'Starson17' @@ -13,6 +16,7 @@ class DrawAndCook(BasicNewsRecipe): remove_javascript = True remove_empty_feeds = True cover_url = 'http://farm5.static.flickr.com/4043/4471139063_4dafced67f_o.jpg' + INDEX = 'http://www.theydrawandcook.com' max_articles_per_feed = 30 remove_attributes = ['style', 'font'] @@ -34,20 +38,21 @@ class DrawAndCook(BasicNewsRecipe): date = '' current_articles = [] soup = self.index_to_soup(url) - recipes = soup.findAll('div', attrs={'class': 'date-outer'}) + featured_major_slider = soup.find(name='div', attrs={'id':'featured_major_slider'}) + recipes = featured_major_slider.findAll('li', attrs={'data-id': re.compile(r'artwork_entry_\d+', re.DOTALL)}) for recipe in recipes: - title = recipe.h3.a.string - page_url = recipe.h3.a['href'] + page_url = self.INDEX + recipe.a['href'] + print 'page_url is: ', page_url + title = recipe.find('strong').string + print 'title is: ', title current_articles.append({'title': title, 'url': page_url, 'description':'', 'date':date}) return current_articles - - keep_only_tags = [dict(name='h3', attrs={'class':'post-title entry-title'}) - ,dict(name='div', attrs={'class':'post-body entry-content'}) + keep_only_tags = [dict(name='h1', attrs={'id':'page_title'}) + ,dict(name='section', attrs={'id':'artwork'}) ] - remove_tags = [dict(name='div', attrs={'class':['separator']}) - ,dict(name='div', attrs={'class':['post-share-buttons']}) + remove_tags = [dict(name='article', attrs={'id':['recipe_actions', 'metadata']}) ] extra_css = '''