mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
61 lines
2.0 KiB
Python
61 lines
2.0 KiB
Python
#!/usr/bin/env python2
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = '2009, Matthew Briggs'
|
|
__docformat__ = 'restructuredtext en'
|
|
|
|
'''
|
|
http://www.theaustralian.news.com.au/
|
|
'''
|
|
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
|
|
def classes(classes):
|
|
q = frozenset(classes.split(' '))
|
|
return dict(attrs={
|
|
'class': lambda x: x and frozenset(x.split()).intersection(q)})
|
|
|
|
|
|
class DailyTelegraph(BasicNewsRecipe):
|
|
title = u'The Australian'
|
|
__author__ = u'Kovid Goyal'
|
|
description = (u'National broadsheet newspaper from down under - colloquially known as The Oz'
|
|
'. You will need to have a subscription to '
|
|
'http://www.theaustralian.com.au to get full articles.')
|
|
language = 'en_AU'
|
|
|
|
oldest_article = 2
|
|
needs_subscription = 'optional'
|
|
max_articles_per_feed = 30
|
|
remove_javascript = True
|
|
no_stylesheets = True
|
|
encoding = 'utf8'
|
|
remove_empty_feeds = True
|
|
ignore_duplicate_articles = {'url'}
|
|
|
|
keep_only_tags = dict(id=['story', 'story-headline'])
|
|
remove_tags = [
|
|
dict(id='comments'),
|
|
classes('story-info story-header-tools module-controls story-sidebar'
|
|
' story-footer story-footer-tools story-extras story-related vms-nav'
|
|
' vms-endcard vms-discover share-tools story-comments-link'
|
|
' vms-controls ooyala-player vms-countdown vms-header comments')
|
|
]
|
|
|
|
feeds = [
|
|
(u'National News', u'http://www.news.com.au/national/rss'),
|
|
(u'World News', u'http://www.news.com.au/world/rss'),
|
|
(u'Entertainmnet', u'http://www.news.com.au/entertainment/rss'),
|
|
(u'Technology', u'http://www.news.com.au/technology/rss'),
|
|
(u'Lifestyle', u'http://www.news.com.au/lifestyle/rss'),
|
|
(u'Sport', u'http://www.news.com.au/sport/rss'),
|
|
(u'Finance', u'http://www.news.com.au/finance/rss'),
|
|
(u'Travel', u'http://www.news.com.au/travel/rss'),
|
|
]
|
|
|
|
def get_article_url(self, article):
|
|
ans = article.link
|
|
if '/video/' in ans:
|
|
return
|
|
return ans
|