mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
3c83a23a88
commit
209f04025f
@ -13,7 +13,7 @@ dt = datetime(year, month, day)
|
|||||||
class BusinessStandardPrint(BasicNewsRecipe):
|
class BusinessStandardPrint(BasicNewsRecipe):
|
||||||
title = 'Business Standard Print Edition'
|
title = 'Business Standard Print Edition'
|
||||||
__author__ = 'unkn0wn'
|
__author__ = 'unkn0wn'
|
||||||
description = 'India's most respected business daily, Articles from Today\'s Paper'
|
description = "India's most respected business daily, Articles from Today's Paper"
|
||||||
language = 'en_IN'
|
language = 'en_IN'
|
||||||
masthead_url = 'https://bsmedia.business-standard.com/include/_mod/site/html5/images/business-standard-logo.png'
|
masthead_url = 'https://bsmedia.business-standard.com/include/_mod/site/html5/images/business-standard-logo.png'
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
@ -24,7 +24,7 @@ class BusinessStandardPrint(BasicNewsRecipe):
|
|||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
remove_attributes = ['width', 'height', 'style']
|
remove_attributes = ['width', 'height', 'style']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
BasicNewsRecipe.__init__(self, *args, **kwargs)
|
BasicNewsRecipe.__init__(self, *args, **kwargs)
|
||||||
if self.output_profile.short_name.startswith('kindle'):
|
if self.output_profile.short_name.startswith('kindle'):
|
||||||
@ -75,7 +75,7 @@ class BusinessStandardPrint(BasicNewsRecipe):
|
|||||||
def preprocess_raw_html(self, raw, *a):
|
def preprocess_raw_html(self, raw, *a):
|
||||||
root = parse(raw)
|
root = parse(raw)
|
||||||
m = root.xpath('//script[@id="__NEXT_DATA__"]')
|
m = root.xpath('//script[@id="__NEXT_DATA__"]')
|
||||||
|
|
||||||
data = json.loads(m[0].text)
|
data = json.loads(m[0].text)
|
||||||
|
|
||||||
img_url = None
|
img_url = None
|
||||||
@ -83,7 +83,7 @@ class BusinessStandardPrint(BasicNewsRecipe):
|
|||||||
img_url = data['props']['pageProps']['articleSchema']['articleImageUrl']
|
img_url = data['props']['pageProps']['articleSchema']['articleImageUrl']
|
||||||
|
|
||||||
art_url = 'https://www.business-standard.com' + data['props']['pageProps']['url']
|
art_url = 'https://www.business-standard.com' + data['props']['pageProps']['url']
|
||||||
|
|
||||||
data = data['props']['pageProps']['data']
|
data = data['props']['pageProps']['data']
|
||||||
|
|
||||||
title = '<h1 title="{}">'.format(art_url) + data['pageTitle'] + '</h1>'
|
title = '<h1 title="{}">'.format(art_url) + data['pageTitle'] + '</h1>'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user