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 09-30-2010, 06:21 PM   #1
limawhiskey
Junior Member
limawhiskey began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2010
Location: UK
Device: Kindle v3
BBC Sport

This is derived from the BBC News (fast) code by Darko Miletic and Starson17. Despite the excellence of their recipe, there is a conspicuous absence of sports news, so I set out to fill that gap.

Spoiler:
Code:
__license__   = 'GPL v3'
__copyright__ = '2010, limawhiskey <limawhiskey at gmail.com>'
'''
news.bbc.co.uk/sport/
'''
import re
from calibre.web.feeds.recipes import BasicNewsRecipe

class BBC(BasicNewsRecipe):
    title                  = 'BBC Sport'
    __author__             = 'limawhiskey, Darko Miletic, Starson17'
    description            = 'Sports news from UK. A fast version that does not download pictures'
    oldest_article         = 2
    max_articles_per_feed  = 100
    no_stylesheets         = True
    use_embedded_content   = False
    encoding               = 'utf8'
    publisher              = 'BBC'
    category               = 'sport, news, UK, world'
    language               = 'en_GB'
    publication_type       = 'newsportal'
    extra_css              = ' body{ font-family: Verdana,Helvetica,Arial,sans-serif } .introduction{font-weight: bold} .story-feature{display: block; padding: 0; border: 1px solid; width: 40%; font-size: small} .story-feature h2{text-align: center; text-transform: uppercase} '
    preprocess_regexps     = [(re.compile(r'<!--.*?-->', re.DOTALL), lambda m: '')]
    conversion_options = {
                             'comments'        : description
                            ,'tags'            : category
                            ,'language'        : language
                            ,'publisher'       : publisher
                            ,'linearize_tables': True
                         }

    keep_only_tags  = [
                       dict(name='div', attrs={'class':['ds','mxb']}), 
                       dict(attrs={'class':['story-body','storybody']})
                      ]

    remove_tags     = [
                       dict(name='div', attrs={'class':['storyextra', 'share-help', 'embedded-hyper', \
                       'story-feature wide ', 'story-feature narrow', 'cap', 'caption', 'q1', 'sihf', \
                       'mva', 'videoInStoryC', 'sharesb', 'mvtb']}), 
                       dict(name=['img']), dict(name=['br'])
                      ]

    remove_attributes = ['width','height']

    feeds          = [
                      ('Sport Front Page', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/front_page/rss.xml'),
                      ('Football', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/rss.xml'),
                      ('Cricket', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/cricket/rss.xml'),
                      ('Formula 1', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/motorsport/formula_one/rss.xml'),
                      ('Commonwealth Games', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/commonwealth_games/delhi_2010/rss.xml'),
                      ('Golf', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/golf/rss.xml'),
                      ('Rugby Union', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/rugby_union/rss.xml'),
                      ('Rugby League', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/rugby_league/rss.xml'),
                      ('Tennis', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/tennis/rss.xml'),
                      ('Motorsport', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/motorsport/rss.xml'),
                      ('Boxing', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/boxing/rss.xml'),
                      ('Athletics', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/athletics/rss.xml'),
                      ('Snooker', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/snooker/rss.xml'),
                      ('Horse Racing', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/horse_racing/rss.xml'),
                      ('Cycling', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/cycling/rss.xml'),
                      ('Disability Sport', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/disability_sport/rss.xml'),
                      ('Other Sport', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/rss.xml'),
                      ('Olympics 2012', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/olympics/london_2012/rss.xml'),
                     ]


If you want to customise which feeds this recipe grabs, just edit the last few lines to add or remove any feeds you want.

Please test it and leave some feedback. I'm quite new to coding and only have a rudimentary understanding of what's going on but I can at least attempt any necessary improvements!

Also I'm not sure whose is the copyright on derivative works, so I put my details as the most recent author. If I'm stepping on any toes, just let me know.

Last edited by limawhiskey; 10-01-2010 at 02:29 PM.
limawhiskey is offline   Reply With Quote
Old 09-30-2010, 06:51 PM   #2
desertgrandma
Enjoying the show....
desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.
 
desertgrandma's Avatar
 
Posts: 14,277
Karma: 8205255
Join Date: Jun 2008
Location: Arizona
Device: A K1, Kindle Paperwhite, an Ipod, IPad2, Iphone, an Ipad Mini & macAir
Welcome to MobileRead, limawhiskey.

Enjoy the forums.
desertgrandma is offline   Reply With Quote
Old 07-23-2011, 04:16 PM   #3
quigo
Junior Member
quigo began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jul 2011
Device: Kindle 3
Hey this recipe hasn't been working correctly for about 2 months, when I open the recipe and select an article I get a completely different article.

I'm new to tweaking or even creating these but would like to learn how to fix this recipe (its a great read ) if it was possible.
quigo is offline   Reply With Quote
Old 07-24-2011, 08:54 AM   #4
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
Quote:
Originally Posted by quigo View Post
Hey this recipe hasn't been working correctly for about 2 months, when I open the recipe and select an article I get a completely different article.

I'm new to tweaking or even creating these but would like to learn how to fix this recipe (its a great read ) if it was possible.
Try the sticky here:
http://www.mobileread.com/forums/sho..._my_own_recipe
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
ASUS DR-570 e-reader to sport 6-inch OLED color screen DonaldL. News 6 01-18-2010 01:33 PM
Sport pdf or ebook sites bluebells2 Reading Recommendations 0 10-31-2009 07:21 AM
Almost Free! Sport, Culture and Society by Grant Jarvie (Sony Reader) DrMoze Deals, Freebies, and Resources (No Self-Promotion) 4 08-07-2008 01:22 PM
Dunbar, Paul Laurence: The Sport of the Gods. v1, 2 Mar 2008 Madam Broshkina Kindle Books 0 03-02-2008 12:43 AM
Dunbar, Paul Laurence: The Sport of the Gods. v1, 2 Mar 2008 Madam Broshkina BBeB/LRF Books 0 03-02-2008 12:41 AM


All times are GMT -4. The time now is 06:58 PM.


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