~stub/ubuntu/precise/calibre/devel

« back to all changes in this revision

Viewing changes to resources/recipes/DrawAndCook.recipe

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-04-12 11:29:25 UTC
  • mfrom: (42.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110412112925-c7171kt2bb5rmft4
Tags: 0.7.50+dfsg-2
* debian/control: Build with libpodofo-dev to enable PDF metadata.
  (Closes: #619632)
* debian/control: Add libboost1.42-dev build dependency. Apparently it is
  needed in some setups. (Closes: #619807)
* debian/rules: Call dh_sip to generate a proper sip API dependency, to
  prevent crashes like #616372 for partial upgrades.
* debian/control: Bump python-qt4 dependency to >= 4.8.3-2, which reportedly
  fixes crashes on startup. (Closes: #619701, #620125)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from calibre.web.feeds.news import BasicNewsRecipe
 
2
import re
2
3
 
3
4
class DrawAndCook(BasicNewsRecipe):
4
5
    title               = 'DrawAndCook'
5
6
    __author__          = 'Starson17'
 
7
    __version__         = 'v1.10'
 
8
    __date__            = '13 March 2011'
6
9
    description         = 'Drawings of recipes!'
7
10
    language            = 'en'
8
11
    publisher           = 'Starson17'
13
16
    remove_javascript   = True
14
17
    remove_empty_feeds    = True
15
18
    cover_url           = 'http://farm5.static.flickr.com/4043/4471139063_4dafced67f_o.jpg'
 
19
    INDEX = 'http://www.theydrawandcook.com'
16
20
    max_articles_per_feed = 30
17
21
 
18
22
    remove_attributes = ['style', 'font']
34
38
        date = ''
35
39
        current_articles = []
36
40
        soup = self.index_to_soup(url)
37
 
        recipes = soup.findAll('div', attrs={'class': 'date-outer'})
 
41
        featured_major_slider = soup.find(name='div', attrs={'id':'featured_major_slider'})
 
42
        recipes = featured_major_slider.findAll('li', attrs={'data-id': re.compile(r'artwork_entry_\d+', re.DOTALL)})
38
43
        for recipe in recipes:
39
 
            title = recipe.h3.a.string
40
 
            page_url = recipe.h3.a['href']
 
44
            page_url = self.INDEX + recipe.a['href']
 
45
            print 'page_url is: ', page_url
 
46
            title = recipe.find('strong').string
 
47
            print 'title is: ', title
41
48
            current_articles.append({'title': title, 'url': page_url, 'description':'', 'date':date})
42
49
        return current_articles
43
50
 
44
 
 
45
 
    keep_only_tags     = [dict(name='h3', attrs={'class':'post-title entry-title'})
46
 
                         ,dict(name='div', attrs={'class':'post-body entry-content'})
 
51
    keep_only_tags     = [dict(name='h1', attrs={'id':'page_title'})
 
52
                         ,dict(name='section', attrs={'id':'artwork'})
47
53
                         ]
48
54
 
49
 
    remove_tags = [dict(name='div', attrs={'class':['separator']})
50
 
                  ,dict(name='div', attrs={'class':['post-share-buttons']})
 
55
    remove_tags = [dict(name='article', attrs={'id':['recipe_actions', 'metadata']})
51
56
                  ]
52
57
 
53
58
    extra_css = '''