mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Frontline
This commit is contained in:
parent
7df0187962
commit
f0342a3d31
@ -21,17 +21,16 @@ class Frontline(BasicNewsRecipe):
|
|||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
soup = self.index_to_soup(
|
soup = self.index_to_soup(
|
||||||
'https://frontline.thehindu.com/current-issue/')
|
'https://frontline.thehindu.com/current-issue/')
|
||||||
tag = soup.find(attrs={'class': 'imgWrapper'})
|
tag = soup.find(attrs={'class': 'sptar-image'})
|
||||||
if tag:
|
if tag:
|
||||||
self.cover_url = tag.find('img')['data-proxy-image'].replace(
|
self.cover_url = tag.find('img')['data-original']
|
||||||
"FREE_100", "FREE_810")
|
|
||||||
return super().get_cover_url()
|
return super().get_cover_url()
|
||||||
|
|
||||||
# https://fl.thgim.com/incoming/b5zy2g/article38454943.ece/alternates/FREE_100/coverpng
|
# https://fl.thgim.com/incoming/b5zy2g/article38454943.ece/alternates/FREE_100/coverpng
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
classes(
|
classes(
|
||||||
'overline mainart-title marginBottom10px articleBottomLine swiper-slide slide-caption artlead-text body-main'
|
'overline mainart-title marginBottom10px articleBottomLine swiper-slide slide-caption artlead-text body-main article-container'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
remove_tags = [classes('dispatche-middle bigtitle')]
|
remove_tags = [classes('dispatche-middle bigtitle')]
|
||||||
@ -60,8 +59,9 @@ class Frontline(BasicNewsRecipe):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
for img in soup.findAll('img', attrs={'data-proxy-image': True}):
|
for source in soup.findAll('source', srcset=True, attrs={'media':'(min-width: 1600px)'}):
|
||||||
# replace FREE_810 with FREE_615 FREE_1200.. FREE_300.
|
source.name = 'img'
|
||||||
img['src'] = img['data-proxy-image'].replace(
|
source['src'] = source['srcset']
|
||||||
"FREE_100", "FREE_810")
|
for img in soup.findAll('img', attrs={'data-original':True}):
|
||||||
|
img['src'] = img['data-original']
|
||||||
return soup
|
return soup
|
||||||
|
Loading…
x
Reference in New Issue
Block a user