mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
New recipe for stuff.co.nz by Krittika Goyal
This commit is contained in:
parent
3240c330c1
commit
9e30796443
50
resources/recipes/dominion.recipe
Normal file
50
resources/recipes/dominion.recipe
Normal file
@ -0,0 +1,50 @@
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||
|
||||
class stuffconz(BasicNewsRecipe):
|
||||
title = u'stuff.co.nz'
|
||||
language = 'en_NZ'
|
||||
__author__ = 'Krittika Goyal'
|
||||
oldest_article = 1 #days
|
||||
max_articles_per_feed = 25
|
||||
#encoding = 'latin1'
|
||||
|
||||
remove_stylesheets = True
|
||||
#remove_tags_before = dict(name='h1', attrs={'class':'heading'})
|
||||
remove_tags_after = dict(name='div', attrs={'id':'related_box'})
|
||||
remove_tags = [
|
||||
dict(name='iframe'),
|
||||
dict(name='div', attrs={'class':['story_feature_title']}),
|
||||
dict(name='div', attrs={'id':['toolbox', 'related_box', 'adSTORYBODY']}),
|
||||
dict(name='span', attrs={'class':['related_link', 'slideshowcontrols']}),
|
||||
#dict(name='ul', attrs={'class':'articleTools'}),
|
||||
]
|
||||
|
||||
feeds = [
|
||||
('Dominion Post',
|
||||
'http://www.stuff.co.nz/rss/dominion-post'),
|
||||
('National',
|
||||
'http://www.stuff.co.nz/rss/national'),
|
||||
('World',
|
||||
'http://www.stuff.co.nz/rss/world'),
|
||||
('Business',
|
||||
'http://www.stuff.co.nz/rss/business'),
|
||||
('Technology',
|
||||
'http://www.stuff.co.nz/rss/technology'),
|
||||
('Sport',
|
||||
'http://www.stuff.co.nz/rss/sport'),
|
||||
('Entertainment',
|
||||
'http://www.stuff.co.nz/rss/entertainment'),
|
||||
('Life and Style',
|
||||
'http://www.stuff.co.nz/rss/life-style'),
|
||||
|
||||
]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
story = soup.find(name='div', attrs={'id':'left_col'})
|
||||
#td = heading.findParent(name='td')
|
||||
#td.extract()
|
||||
soup = BeautifulSoup('<html><head><title>t</title></head><body></body></html>')
|
||||
body = soup.find(name='body')
|
||||
body.insert(0, story)
|
||||
return soup
|
@ -6,7 +6,7 @@ class NewZealandHerald(BasicNewsRecipe):
|
||||
__author__ = 'Krittika Goyal'
|
||||
description = 'Daily news'
|
||||
timefmt = ' [%d %b, %Y]'
|
||||
language = 'en_AU'
|
||||
language = 'en_NZ'
|
||||
|
||||
no_stylesheets = True
|
||||
remove_tags_before = dict(name='div', attrs={'class':'contentContainer left eight'})
|
||||
|
@ -97,6 +97,7 @@ _extra_lang_codes = {
|
||||
'zh_TW' : _('Traditional Chinese'),
|
||||
'en' : _('English'),
|
||||
'en_AU' : _('English (Australia)'),
|
||||
'en_NZ' : _('English (New Zealand)'),
|
||||
'en_CA' : _('English (Canada)'),
|
||||
'en_IN' : _('English (India)'),
|
||||
'en_TH' : _('English (Thailand)'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user