Fix Inquirer.net

This commit is contained in:
Kovid Goyal 2011-09-11 15:49:03 -06:00
parent 8a7100b338
commit d76c312c89

View File

@ -7,56 +7,33 @@ www.inquirer.net
''' '''
from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.web.feeds.recipes import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import Tag
class InquirerNet(BasicNewsRecipe): class InquirerNet(BasicNewsRecipe):
title = 'Inquirer.net' title = 'Inquirer.net'
__author__ = 'Darko Miletic' __author__ = 'Krittika Goyal'
description = 'News from Philipines' description = 'News from Philipines'
oldest_article = 2 oldest_article = 2
max_articles_per_feed = 100 max_articles_per_feed = 100
no_stylesheets = True no_stylesheets = True
use_embedded_content = False use_embedded_content = False
encoding = 'cp1252' encoding = 'utf8'
publisher = 'inquirer.net' publisher = 'inquirer.net'
category = 'news, politics, philipines' category = 'news, politics, philipines'
lang = 'en' lang = 'en'
language = 'en' language = 'en'
extra_css = ' .fontheadline{font-size: x-large} .fontsubheadline{font-size: large} .fontkick{font-size: medium}' use_embedded_content = False
html2lrf_options = [ no_stylesheets = True
'--comment', description auto_cleanup = True
, '--category', category
, '--publisher', publisher
, '--ignore-tables'
]
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True'
remove_tags = [dict(name=['object','link','script','iframe','form'])]
feeds = [ feeds = [
(u'Breaking news', u'http://services.inquirer.net/rss/breakingnews.xml' ) (u'Inquirer', u'http://www.inquirer.net/fullfeed')
,(u'Top stories' , u'http://services.inquirer.net/rss/topstories.xml' )
,(u'Sports' , u'http://services.inquirer.net/rss/brk_breakingnews.xml' )
,(u'InfoTech' , u'http://services.inquirer.net/rss/infotech_tech.xml' )
,(u'InfoTech' , u'http://services.inquirer.net/rss/infotech_tech.xml' )
,(u'Business' , u'http://services.inquirer.net/rss/inq7money_breaking_news.xml' )
,(u'Editorial' , u'http://services.inquirer.net/rss/opinion_editorial.xml' )
,(u'Global Nation', u'http://services.inquirer.net/rss/globalnation_breakingnews.xml')
] ]
def preprocess_html(self, soup): def get_browser(self):
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) br = BasicNewsRecipe.get_browser(self)
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")]) br.set_handle_gzip(True)
soup.head.insert(0,mlang) return br
soup.head.insert(1,mcharset)
for item in soup.findAll(style=True):
del item['style']
return soup
def print_version(self, url):
rest, sep, art = url.rpartition('/view/')
art_id, sp, rrest = art.partition('/')
return 'http://services.inquirer.net/print/print.php?article_id=' + art_id