mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
New recipe for the Straits Times by Darko Miletic
This commit is contained in:
parent
e121e8523b
commit
5d3c309258
BIN
src/calibre/gui2/images/news/straitstimes.png
Normal file
BIN
src/calibre/gui2/images/news/straitstimes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 953 B |
@ -42,6 +42,7 @@ recipe_modules = ['recipe_' + r for r in (
|
||||
'moneynews', 'der_standard', 'diepresse', 'nzz_ger', 'hna',
|
||||
'seattle_times', 'scott_hanselman', 'coding_horror', 'twitchfilms',
|
||||
'stackoverflow', 'telepolis_artikel', 'zaobao', 'usnews',
|
||||
'straitstimes',
|
||||
)]
|
||||
|
||||
import re, imp, inspect, time, os
|
||||
|
56
src/calibre/web/feeds/recipes/recipe_straitstimes.py
Normal file
56
src/calibre/web/feeds/recipes/recipe_straitstimes.py
Normal file
@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
'''
|
||||
www.straitstimes.com
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
|
||||
class StraitsTimes(BasicNewsRecipe):
|
||||
title = 'The Straits Times'
|
||||
__author__ = 'Darko Miletic'
|
||||
description = 'Singapore newspaper'
|
||||
oldest_article = 2
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
encoding = 'cp1252'
|
||||
publisher = 'Singapore Press Holdings Ltd.'
|
||||
category = 'news, politics, singapore, asia'
|
||||
language = _('English')
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment', description
|
||||
, '--category', category
|
||||
, '--publisher', publisher
|
||||
, '--ignore-tables'
|
||||
]
|
||||
|
||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True'
|
||||
|
||||
remove_tags = [
|
||||
dict(name=['object','link'])
|
||||
,dict(name='table', attrs={'width':'980'})
|
||||
,dict(name='td' , attrs={'class':'padlrt10'})
|
||||
]
|
||||
|
||||
feeds = [
|
||||
(u'Singapore' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_singapore.xml' )
|
||||
,(u'SE Asia' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_sea.xml' )
|
||||
,(u'Money' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_money.xml' )
|
||||
,(u'Sport' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_sport.xml' )
|
||||
,(u'World' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_world.xml' )
|
||||
,(u'Tech & Science' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_tech.xml' )
|
||||
,(u'Lifestyle' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_lifestyle.xml' )
|
||||
]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
for item in soup.findAll(style=True):
|
||||
del item['style']
|
||||
return soup
|
||||
|
||||
def print_version(self, url):
|
||||
return url.replace('http://www.straitstimes.com','http://www.straitstimes.com/print')
|
||||
|
Loading…
x
Reference in New Issue
Block a user