mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/unkn0w7n/calibre
This commit is contained in:
commit
2aec8675cd
@ -19,8 +19,10 @@ def classes(classes):
|
||||
def extract_json(raw):
|
||||
s = raw.find("window['__natgeo__']")
|
||||
script = raw[s:raw.find('</script>', s)]
|
||||
return json.loads(
|
||||
script[script.find('{'):].rstrip(';'))['page']['content']['article']
|
||||
data = json.loads(script[script.find('{'):].rstrip(';'))['page']['content']
|
||||
if 'article' in data:
|
||||
return data['article']
|
||||
return data['prismarticle']
|
||||
|
||||
|
||||
def parse_contributors(grp):
|
||||
@ -32,6 +34,7 @@ def parse_contributors(grp):
|
||||
|
||||
|
||||
def parse_lead_image(media):
|
||||
if 'image' in media:
|
||||
if 'dsc' in media['image']:
|
||||
yield '<p><div><img src="{}" alt="{}"></div>'.format(
|
||||
escape(media['image']['src'], True), escape(media['image']['dsc'], True))
|
||||
|
@ -18,8 +18,10 @@ def classes(classes):
|
||||
def extract_json(raw):
|
||||
s = raw.find("window['__natgeo__']")
|
||||
script = raw[s:raw.find('</script>', s)]
|
||||
return json.loads(
|
||||
script[script.find('{'):].rstrip(';'))['page']['content']['article']
|
||||
data = json.loads(script[script.find('{'):].rstrip(';'))['page']['content']
|
||||
if 'article' in data:
|
||||
return data['article']
|
||||
return data['prismarticle']
|
||||
|
||||
|
||||
def parse_contributors(grp):
|
||||
@ -31,6 +33,7 @@ def parse_contributors(grp):
|
||||
|
||||
|
||||
def parse_lead_image(media):
|
||||
if 'image' in media:
|
||||
if 'dsc' in media['image']:
|
||||
yield '<p><div><img src="{}" alt="{}"></div>'.format(
|
||||
escape(media['image']['src'], True), escape(media['image']['dsc'], True))
|
||||
|
@ -23,8 +23,10 @@ def classes(classes):
|
||||
def extract_json(raw):
|
||||
s = raw.find("window['__natgeo__']")
|
||||
script = raw[s:raw.find('</script>', s)]
|
||||
return json.loads(
|
||||
script[script.find('{'):].rstrip(';'))['page']['content']['article']
|
||||
data = json.loads(script[script.find('{'):].rstrip(';'))['page']['content']
|
||||
if 'article' in data:
|
||||
return data['article']
|
||||
return data['prismarticle']
|
||||
|
||||
|
||||
def parse_contributors(grp):
|
||||
@ -36,6 +38,7 @@ def parse_contributors(grp):
|
||||
|
||||
|
||||
def parse_lead_image(media):
|
||||
if 'image' in media:
|
||||
if 'dsc' in media['image']:
|
||||
yield '<p><div><img src="{}" alt="{}"></div>'.format(
|
||||
escape(media['image']['src'], True), escape(media['image']['dsc'], True))
|
||||
|
Loading…
x
Reference in New Issue
Block a user