mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Update The Times of India
This commit is contained in:
parent
78ddc2799d
commit
1f09ee2e97
@ -9,7 +9,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class TheEconomicTimes(BasicNewsRecipe):
|
||||
title = 'The Times of India'
|
||||
__author__ = 'Karthik K'
|
||||
__author__ = 'Karthik'
|
||||
description = 'News from the Indian daily Times of India'
|
||||
publisher = 'timesofindia.indiatimes.com'
|
||||
category = 'news, finances, politics, sports, business, entertainment, India'
|
||||
@ -38,7 +38,9 @@ class TheEconomicTimes(BasicNewsRecipe):
|
||||
}
|
||||
remove_tags_before = dict(name='h1')
|
||||
remove_tags_after = dict(name='div', attrs={'class':'storycontent'})
|
||||
remove_attributes = ['xmlns']
|
||||
remove_attributes = ['xmlns', 'style']
|
||||
remove_tags = [dict(name='div', attrs={'class':'readalso'})]
|
||||
|
||||
feeds = [('Recent Stories', 'http://timesofindia.indiatimes.com/rssfeeds/1221656.cms'),
|
||||
('India', 'http://timesofindia.indiatimes.com/rssfeeds/-2128936835.cms'),
|
||||
('World', 'http://timesofindia.indiatimes.com/rssfeeds/296589292.cms'),
|
||||
@ -51,22 +53,15 @@ class TheEconomicTimes(BasicNewsRecipe):
|
||||
('Opinion', 'http://timesofindia.indiatimes.com/rssfeeds/784865811.cms'),
|
||||
('Entertainment', 'http://timesofindia.indiatimes.com/rssfeeds/1081479906.cms')]
|
||||
|
||||
|
||||
#Uses the mobile print version. For web print version use 'http://timesofindia.indiatimes.com/articleshow/<article_id>?prtpage=1'
|
||||
def print_version(self, url):
|
||||
rest, sep, article_id = url.rpartition('/articleshow/')
|
||||
return 'http://m.timesofindia.com/PDAET/articleshow/' + article_id
|
||||
return url.replace('/articleshow/', '/articleshowprint/')
|
||||
# For mobile version
|
||||
# return 'http://m.timesofindia.com/PDAET/articleshow/' + article_id
|
||||
|
||||
def get_article_url(self, article):
|
||||
rurl = article.get('guid', None)
|
||||
if (rurl.find('/quickieslist/') > 0) or (rurl.find('/quickiearticleshow/') > 0):
|
||||
return None
|
||||
return rurl
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
for item in soup.findAll(style=True):
|
||||
del item['style']
|
||||
return soup
|
||||
if '/articleshow/' in rurl:
|
||||
return rurl
|
||||
|
||||
def postprocess_html(self, soup, first_fetch):
|
||||
return self.adeify_images(soup)
|
||||
|
Loading…
x
Reference in New Issue
Block a user