mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'smh-au-recipe-fix' of https://github.com/ping/calibre
This commit is contained in:
commit
7e72349b5f
@ -1,66 +1,50 @@
|
|||||||
__license__ = 'GPL v3'
|
__license__ = "GPL v3"
|
||||||
__copyright__ = '2010-2011, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = "2010-2011, Darko Miletic <darko.miletic at gmail.com>"
|
||||||
'''
|
"""
|
||||||
smh.com.au
|
smh.com.au
|
||||||
'''
|
"""
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
|
||||||
class Smh_au(BasicNewsRecipe):
|
class Smh_au(BasicNewsRecipe):
|
||||||
title = 'The Sydney Morning Herald'
|
title = "The Sydney Morning Herald"
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = "Darko Miletic"
|
||||||
description = 'Breaking news from Sydney, Australia and the world. Features the latest business, sport, entertainment, travel, lifestyle, and technology news.' # noqa
|
description = "Breaking news from Sydney, Australia and the world. Features the latest business, sport, entertainment, travel, lifestyle, and technology news." # noqa
|
||||||
publisher = 'Fairfax Digital'
|
publisher = "Fairfax Digital"
|
||||||
category = 'news, politics, Australia, Sydney'
|
category = "news, politics, Australia, Sydney"
|
||||||
oldest_article = 2
|
oldest_article = 2
|
||||||
max_articles_per_feed = 200
|
max_articles_per_feed = 200
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
ignore_duplicate_articles = {'title', 'url'}
|
ignore_duplicate_articles = {"title", "url"}
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
encoding = 'utf-8'
|
encoding = "utf-8"
|
||||||
use_embedded_content = False
|
|
||||||
language = 'en_AU'
|
language = "en_AU"
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
masthead_url = 'http://images.smh.com.au/2010/02/02/1087188/smh-620.jpg'
|
masthead_url = "http://images.smh.com.au/2010/02/02/1087188/smh-620.jpg"
|
||||||
publication_type = 'newspaper'
|
publication_type = "newspaper"
|
||||||
extra_css = """
|
|
||||||
h1{font-family: Georgia,"Times New Roman",Times,serif }
|
|
||||||
body{font-family: Arial,Helvetica,sans-serif}
|
|
||||||
.cT-imageLandscape,.cT-imagePortrait{font-size: x-small}
|
|
||||||
"""
|
|
||||||
|
|
||||||
feeds = [
|
keep_only_tags = [dict(name="article")]
|
||||||
('Politics', 'http://www.smh.com.au/rssheadlines/political-news/article/rss.xml'),
|
|
||||||
('NSW News', 'http://www.smh.com.au/rssheadlines/nsw/article/rss.xml'),
|
|
||||||
('World', 'http://www.smh.com.au/rssheadlines/world/article/rss.xml'),
|
|
||||||
('National', 'http://www.smh.com.au/rssheadlines/national/article/rss.xml'),
|
|
||||||
('Business', 'http://www.smh.com.au/rssheadlines/business/article/rss.xml'),
|
|
||||||
('Entertainment', 'http://feeds.smh.com.au/rssheadlines/entertainment.xml'),
|
|
||||||
('Technology', 'http://www.smh.com.au/rssheadlines/technology-news/article/rss.xml'),
|
|
||||||
('Health', 'http://www.smh.com.au/rssheadlines/health/article/rss.xml'),
|
|
||||||
('Sport', 'http://feeds.smh.com.au/rssheadlines/sport.xml'),
|
|
||||||
('Cricket', 'http://www.smh.com.au/rssheadlines/cricket/article/rss.xml'),
|
|
||||||
]
|
|
||||||
|
|
||||||
remove_tags_after = [
|
|
||||||
dict(name='div', attrs={'class': 'articleBody'})
|
|
||||||
]
|
|
||||||
keep_only_tags = [
|
|
||||||
dict(name='div', attrs={'id': 'content'})
|
|
||||||
]
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name='div', attrs={
|
dict(name=["button"]),
|
||||||
'id': ['googleAds', 'moreGoogleAds', 'comments', 'video-player-content']}),
|
dict(id=["saveTooltip"]),
|
||||||
dict(name='div', attrs={'class': 'cT-imageMultimedia'}),
|
dict(attrs={"class": "noPrint"}),
|
||||||
dict(name=['object', 'embed', 'iframe']),
|
|
||||||
dict(attrs={'class': 'hidden'}),
|
|
||||||
dict(name=['link', 'meta', 'base', 'embed', 'object', 'iframe'])
|
|
||||||
]
|
]
|
||||||
remove_attributes = ['width', 'height', 'lang']
|
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
# https://www.smh.com.au/rssheadlines
|
||||||
for item in soup.findAll(style=True):
|
feeds = [
|
||||||
del item['style']
|
("Latest News", "https://www.smh.com.au/rss/feed.xml"),
|
||||||
for item in soup.findAll('bod'):
|
("Federal Politics", "https://www.smh.com.au/rss/politics/federal.xml"),
|
||||||
item.name = 'div'
|
("NSW News", "https://www.smh.com.au/rss/national/nsw.xml"),
|
||||||
return soup
|
("World", "https://www.smh.com.au/rss/world.xml"),
|
||||||
|
("National", "https://www.smh.com.au/rss/national.xml"),
|
||||||
|
("Business", "https://www.smh.com.au/rss/business.xml"),
|
||||||
|
("Culture", "https://www.smh.com.au/rss/culture.xml"),
|
||||||
|
("Technology", "https://www.smh.com.au/rss/technology.xml"),
|
||||||
|
("Environment", "https://www.smh.com.au/rss/environment.xml"),
|
||||||
|
("Lifestyle", "https://www.smh.com.au/rss/lifestyle.xml"),
|
||||||
|
("Property", "https://www.smh.com.au/rss/property.xml"),
|
||||||
|
("Sport", "https://www.smh.com.au/rss/sport.xml"),
|
||||||
|
("Ruby League", "https://www.smh.com.au/rss/sport/nrl.xml"),
|
||||||
|
("AFL", "https://www.smh.com.au/rss/sport/afl.xml"),
|
||||||
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user