View Single Post
Old 03-18-2010, 09:10 PM   #1629
adrnalin
Junior Member
adrnalin began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2010
Device: Sony PRS-600
Daily Telegraph Custom Recipe

Hi all,

This is my first post and i'd like to contribute my recipe for Australia Daily Telegraph. It's a cleaner than the original version, hopefully you guys enjoy it

Code:
#!/usr/bin/env  python
__license__   = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'

'''
http://www.news.com.au/dailytelegraph/
'''
import re
from calibre.web.feeds.news import BasicNewsRecipe

class DailyTelegraph(BasicNewsRecipe):
    title          = u'Daily Telegraph'
    __author__     = u'Adrian G.'
    language = 'en_AU'

    description    = u'Daily Telegraph News'
    oldest_article = 5
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    no_javascript = True


    timefmt               = ' [%A, %d %B, %Y]'
    encoding = 'utf-8'

    keep_only_tags = [dict(name='div', attrs ={'id':'story'})]

    extra_css = '''
                  h1{font-family:Georgia,"Times New Roman",Times,serif; font-weight:bold; font-size:large;}
                  .cT-storyDetails{font-family:Arial,Helvetica,sans-serif; color:#666666;font-size:x-small;}
                  .articleBody{font-family:Arial,Helvetica,sans-serif; color:black;font-size:small;}
                  .cT-imageLandscape{font-family:Arial,Helvetica,sans-serif; color:#333333 ;font-size:x-small;}
                  .source{font-family:Arial,Helvetica,sans-serif; color:#333333 ;font-size:xx-small;}
                  #content{font-family:Arial,Helvetica,sans-serif;font-size:x-small;}
                  .pageprint{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                  #bylineDetails{font-family:Arial,Helvetica,sans-serif; color:#666666;font-size:x-small;}
                  .featurePic-wide{font-family:Arial,Helvetica,sans-serif;font-size:x-small;}
                  #idfeaturepic{font-family:Arial,Helvetica,sans-serif;font-size:x-small;}
                  h3{font-family:Georgia,"Times New Roman",Times,serif; font-size:small;}
                  h2{font-family:Georgia,"Times New Roman",Times,serif; font-size:small;}
                  h4{font-family:Georgia,"Times New Roman",Times,serif; font-size:small;}
                  h5{font-family:Georgia,"Times New Roman",Times,serif; font-size:small;}
                  body{font-family:Arial,Helvetica,sans-serif; font-size:x-small;}
                '''

    remove_tags     = [
                        dict(name='div', attrs ={'id':['comments','story-related-coverage']}),
                        dict(name='div', attrs ={'class':['story-header-tools','story-footer','story-extras','story-related']}),
                        dict(name='div', attrs ={'class':['promo-image','story-extras story-extras-2']}),
                        dict(name='div', attrs ={'class':['assistive sidebar-jump']})
                       ]

    feeds          = [
                      (u'Top Stories', u'http://feeds.news.com.au/public/rss/2.0/dtele_top_stories_253.xml'),
                      (u'National News', u'http://feeds.news.com.au/public/rss/2.0/dtele_national_news_202.xml'),
                      (u'World News', u'http://feeds.news.com.au/public/rss/2.0/dtele_world_news_204.xml'), 
                      (u'NSW and ACT', u'http://feeds.news.com.au/public/rss/2.0/dtele_nswact_225.xml'),
                      (u'Arts', u'http://feeds.news.com.au/public/rss/2.0/dtele_art_444.xml'), 
                      (u'Business News', u'http://feeds.news.com.au/public/rss/2.0/dtele_business_226.xml'), 
                      (u'Entertainment News', u'http://feeds.news.com.au/public/rss/2.0/dtele_entertainment_news_201.xml'), 
                      (u'Lifestyle News', u'http://feeds.news.com.au/public/rss/2.0/dtele_lifestyle_227.xml'), 
                      (u'Music', u'http://feeds.news.com.au/public/rss/2.0/dtele_music_441.xml'), 
                      (u'Property Confidential', u'http://feeds.news.com.au/public/rss/2.0/dtele_property_confidential_463.xml'), 
                      (u'Property - Your Space', u'http://feeds.news.com.au/public/rss/2.0/dtele_property_yourspace_462.xml'),
                      (u'Confidential News', u'http://feeds.news.com.au/public/rss/2.0/dtele_entertainment_confidential_252.xml'), 
                      (u'Confidential Biographies', u'http://feeds.news.com.au/public/rss/2.0/dtele_confidential_biographies_491.xml'), 
                      (u'Confidential Galleries', u'http://feeds.news.com.au/public/rss/2.0/dtele_confidential_galleries_483.xml'),
                      ]
adrnalin is offline