mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'hindu-cover' of https://github.com/shivaprsd/calibre
This commit is contained in:
commit
4df402cacf
@ -15,12 +15,15 @@ def classes(classes):
|
|||||||
class TheHindu(BasicNewsRecipe):
|
class TheHindu(BasicNewsRecipe):
|
||||||
title = u'The Hindu'
|
title = u'The Hindu'
|
||||||
language = 'en_IN'
|
language = 'en_IN'
|
||||||
|
epaper_url = 'https://epaper.thehindu.com'
|
||||||
|
|
||||||
oldest_article = 1
|
oldest_article = 1
|
||||||
__author__ = 'Kovid Goyal'
|
__author__ = 'Kovid Goyal'
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
remove_attributes = ['style']
|
remove_attributes = ['style']
|
||||||
|
extra_css = '.lead-img-cont { text-align: center; } ' \
|
||||||
|
'.lead-img-caption { font-size: small; font-style: italic; }'
|
||||||
|
|
||||||
ignore_duplicate_articles = {'title', 'url'}
|
ignore_duplicate_articles = {'title', 'url'}
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
@ -29,6 +32,15 @@ class TheHindu(BasicNewsRecipe):
|
|||||||
dict(id=lambda x: x and x.startswith('content-body-')),
|
dict(id=lambda x: x and x.startswith('content-body-')),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def get_browser(self):
|
||||||
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
|
br.addheaders += [('Referer', self.epaper_url)] # needed for fetching cover
|
||||||
|
return br
|
||||||
|
|
||||||
|
def get_cover_url(self):
|
||||||
|
url = self.index_to_soup(self.epaper_url + '/Login/DefaultImage', raw=True)
|
||||||
|
return url.replace(br'\\', b'/').decode('utf-8')[1:-1]
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
img = soup.find('img', attrs={'class': 'lead-img'})
|
img = soup.find('img', attrs={'class': 'lead-img'})
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user