View Single Post
Old 08-30-2010, 06:06 PM   #2569
bmsleight
Member
bmsleight will become famous soon enoughbmsleight will become famous soon enoughbmsleight will become famous soon enoughbmsleight will become famous soon enoughbmsleight will become famous soon enoughbmsleight will become famous soon enough
 
Posts: 24
Karma: 540
Join Date: Aug 2010
Device: Kindle 3
Hackaday

First recipe for me.

Spoiler:
Code:
#!/usr/bin/env  python
__license__   = 'GPL v3'
__copyright__ = '2010, Brendan Sleight <bms.calibre at barwap.com>'
'''
hackaday.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Hackaday(BasicNewsRecipe):
    title                 = u'Hackaday'
    __author__            = 'bmsleight'
    description           = 'Hack a Day serves up fresh hacks each day, every day from around the web and a special How-To hack each week.'
    oldest_article        = 10
    max_articles_per_feed = 100
    no_stylesheets        = True
    language              = 'en'

    use_embedded_content  = False

    keep_only_tags      = [
                           dict(name='div', attrs={'class':'post'})
                          ,dict(name='div', attrs={'class':'commentlinks'})
                          ]


    feeds               = [
                         (u'Hack A Day'        , u'http://hackaday.com/feed/'                                      )
                         ]

    def get_article_url(self, article):
        url = article.get('guid', None)
        return url
bmsleight is offline