mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'hindu-patch' of https://github.com/shivaprsd/calibre
This commit is contained in:
commit
c9c1029d02
@ -23,12 +23,14 @@ class TheHindu(BasicNewsRecipe):
|
|||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
remove_attributes = ['style']
|
remove_attributes = ['style']
|
||||||
extra_css = '.lead-img-cont { text-align: center; } ' \
|
extra_css = '.lead-img-cont { text-align: center; } ' \
|
||||||
'.lead-img-caption { font-size: small; font-style: italic; }'
|
'.lead-img-caption { font-size: small; font-style: italic; } ' \
|
||||||
|
'.mobile-author-cont { font-size: small; text-transform: uppercase; } ' \
|
||||||
|
'.intro ~ .intro, .update-time, .ksl-time-stamp * { display: none; } '
|
||||||
|
|
||||||
ignore_duplicate_articles = {'title', 'url'}
|
ignore_duplicate_articles = {'title', 'url'}
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
dict(name='h1', attrs={'class': ['title', 'special-article-heading']}),
|
dict(name='h1', attrs={'class': ['title', 'special-article-heading']}),
|
||||||
classes('author-nm lead-img-cont mobile-author-cont photo-collage intro'),
|
classes('lead-img-cont mobile-author-cont photo-collage intro'),
|
||||||
dict(id=lambda x: x and x.startswith('content-body-')),
|
dict(id=lambda x: x and x.startswith('content-body-')),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -50,9 +52,15 @@ class TheHindu(BasicNewsRecipe):
|
|||||||
source.extract()
|
source.extract()
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
# Remove duplicate intro
|
# Place intro beneath the title, skip duplicates
|
||||||
for h in soup.findAll('h2', attrs={'class': 'intro'})[1:]:
|
try:
|
||||||
h.extract()
|
soup.h1.insert_after(soup.find('h2', attrs={'class': 'intro'}))
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
# Remove ',' from location tag
|
||||||
|
ts = soup.find('span', attrs={'class': 'ksl-time-stamp'})
|
||||||
|
if ts and ts.string:
|
||||||
|
ts.string = ts.string.split(',')[0]
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
def populate_article_metadata(self, article, soup, first):
|
def populate_article_metadata(self, article, soup, first):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user