mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
workaround for nyt todays paper page using undefinedinstead of null in its json
This commit is contained in:
parent
803da449ba
commit
07b4239634
@ -186,7 +186,8 @@ class NewYorkTimes(BasicNewsRecipe):
|
||||
soup = self.read_nyt_metadata()
|
||||
script = soup.findAll('script', text=lambda x: x and 'window.__preloadedData' in x)[0]
|
||||
script = type(u'')(script)
|
||||
data = json.loads(script[script.find('{'):script.rfind(';')].strip().rstrip(';'))['initialState']
|
||||
json_data = script[script.find('{'):script.rfind(';')].strip().rstrip(';')
|
||||
data = json.loads(json_data.replace(':undefined', ':null'))['initialState']
|
||||
containers, sections = {}, {}
|
||||
article_map = {}
|
||||
gc_pat = re.compile(r'groupings.(\d+).containers.(\d+)')
|
||||
|
@ -186,7 +186,8 @@ class NewYorkTimes(BasicNewsRecipe):
|
||||
soup = self.read_nyt_metadata()
|
||||
script = soup.findAll('script', text=lambda x: x and 'window.__preloadedData' in x)[0]
|
||||
script = type(u'')(script)
|
||||
data = json.loads(script[script.find('{'):script.rfind(';')].strip().rstrip(';'))['initialState']
|
||||
json_data = script[script.find('{'):script.rfind(';')].strip().rstrip(';')
|
||||
data = json.loads(json_data.replace(':undefined', ':null'))['initialState']
|
||||
containers, sections = {}, {}
|
||||
article_map = {}
|
||||
gc_pat = re.compile(r'groupings.(\d+).containers.(\d+)')
|
||||
|
Loading…
x
Reference in New Issue
Block a user