Update Jerusalem Post

This commit is contained in:
Kovid Goyal 2014-06-09 13:08:17 +05:30
parent 2e4c1b6277
commit 90ff907df3

View File

@ -6,37 +6,39 @@ class JerusalemPost(BasicNewsRecipe):
title = 'Jerusalem Post' title = 'Jerusalem Post'
description = 'News from Israel and the Middle East' description = 'News from Israel and the Middle East'
use_embedded_content = False use_embedded_content = False
auto_cleanup = True
auto_cleanup_keep = '//img[@id="ctl00_ContentPlaceHolder1_article_control_image"]'
language = 'en' language = 'en'
__author__ = 'Kovid Goyal' __author__ = 'Kovid Goyal'
max_articles_per_feed = 10 max_articles_per_feed = 10
no_stylesheets = True no_stylesheets = True
feeds = [ ('Front Page', 'http://www.jpost.com/servlet/Satellite?pagename=JPost/Page/RSS&cid=1123495333346'), feeds = [ ('Front Page', 'http://www.jpost.com/Rss/RssFeedsFrontPage.aspx'),
('Israel News', 'http://www.jpost.com/servlet/Satellite?pagename=JPost/Page/RSS&cid=1178443463156'), ('Israel News', 'http://www.jpost.com/Rss/RssFeedsIsraelNews.aspx'),
('Middle East News', 'http://www.jpost.com/servlet/Satellite?pagename=JPost/Page/RSS&cid=1123495333498'), ('Middle East News', 'http://www.jpost.com/Rss/RssFeedsMiddleEastNews.aspx'),
('International News', 'http://www.jpost.com/servlet/Satellite?pagename=JPost/Page/RSS&cid=1178443463144'), ('International News', 'http://www.jpost.com/Rss/RssFeedsInternationalNews.aspx'),
('Editorials', 'http://www.jpost.com/servlet/Satellite?pagename=JPost/Page/RSS&cid=1123495333211'), ('Editorials', 'http://www.jpost.com/Rss/RssFeedsEditorialsNews.aspx'),
] ]
remove_tags = [ #remove_tags = [
dict(id=lambda x: x and 'ads.' in x), #dict(id=lambda x: x and 'ads.' in x),
dict(attrs={'class':['printinfo', 'tt1']}), #dict(attrs={'class':['printinfo', 'tt1']}),
dict(onclick='DoPrint()'), #dict(onclick='DoPrint()'),
dict(name='input'), #dict(name='input'),
] #]
conversion_options = {'linearize_tables':True} #conversion_options = {'linearize_tables':True}
def preprocess_html(self, soup): #def preprocess_html(self, soup):
for tag in soup.findAll('form'): #for tag in soup.findAll('form'):
tag.name = 'div' #tag.name = 'div'
return soup #return soup
def print_version(self, url): #def print_version(self, url):
m = re.search(r'(ID|id)=(\d+)', url) #m = re.search(r'(ID|id)=(\d+)', url)
if m is not None: #if m is not None:
id_ = m.group(2) #id_ = m.group(2)
return 'http://www.jpost.com/LandedPages/PrintArticle.aspx?id=%s'%id_ #return 'http://www.jpost.com/LandedPages/PrintArticle.aspx?id=%s'%id_
return url #return url