Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 03-13-2011, 11:59 AM   #1
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Updated Recipe: They Draw and Cook

Draw and Cook has changed. This fixes the recipe and a png favicon is in the zip. Kovid, please update it and add the favicon.
Thanks!
Code:
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'
    category            = 'news, food, recipes'
    use_embedded_content= False
    no_stylesheets      = True
    oldest_article      = 24
    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']

    def parse_index(self):
        feeds = []
        for title, url in [
                            ("They Draw and Cook", "http://www.theydrawandcook.com/")
                            ]:
            articles = self.make_links(url)
            if articles:
                feeds.append((title, articles))
        print 'feeds are: ', feeds
        return feeds

    def make_links(self, url):
        soup = self.index_to_soup(url)
        title = ''
        date = ''
        current_articles = []
        soup = self.index_to_soup(url)
        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:
            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='h1', attrs={'id':'page_title'})
                         ,dict(name='section', attrs={'id':'artwork'})
                         ]

    remove_tags = [dict(name='article', attrs={'id':['recipe_actions', 'metadata']})
                  ]

    remove_tags_after = dict(name='article', attrs={'id':'metadata'})
                  

    extra_css = '''
                    h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
                    h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
                    img {max-width:100%; min-width:100%;}
                    p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
		'''
Attached Files
File Type: zip DrawAndCook.zip (1.8 KB, 83 views)

Last edited by Starson17; 03-19-2011 at 04:20 PM.
Starson17 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nature news - updated recipe Alexis Recipes 3 10-05-2012 03:36 PM
EPL Talk Recipe Updated rylsfan Recipes 0 03-01-2011 10:05 AM
Updated recipe for Le Monde? veezh Recipes 5 01-20-2011 10:06 PM
One new recipe and other one updated (In Spanish) desUBIKado Recipes 3 01-19-2011 04:58 AM
Updated New York Times recipe nickredding Recipes 2 11-20-2010 11:53 AM


All times are GMT -4. The time now is 12:39 PM.


MobileRead.com is a privately owned, operated and funded community.