mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Ozon.ru metadata plugin for website changes. Fixes #1715347 [Crash getting metadata from Ozon.ru](https://bugs.launchpad.net/calibre/+bug/1715347)
This commit is contained in:
parent
fcd533a21c
commit
788d2d6611
@ -23,7 +23,7 @@ from calibre.ebooks.metadata.book.base import Metadata
|
|||||||
class Ozon(Source):
|
class Ozon(Source):
|
||||||
name = 'OZON.ru'
|
name = 'OZON.ru'
|
||||||
minimum_calibre_version = (2, 80, 0)
|
minimum_calibre_version = (2, 80, 0)
|
||||||
version = (1, 0, 0)
|
version = (1, 1, 0)
|
||||||
description = _('Downloads metadata and covers from OZON.ru (updated)')
|
description = _('Downloads metadata and covers from OZON.ru (updated)')
|
||||||
|
|
||||||
capabilities = frozenset(['identify', 'cover'])
|
capabilities = frozenset(['identify', 'cover'])
|
||||||
@ -152,6 +152,10 @@ class Ozon(Source):
|
|||||||
json_pat = re.compile(u'dataLayer\s*=\s*(.+)?;')
|
json_pat = re.compile(u'dataLayer\s*=\s*(.+)?;')
|
||||||
json_info = re.search(json_pat, entry_string)
|
json_info = re.search(json_pat, entry_string)
|
||||||
jsondata = json_info.group(1) if json_info else None
|
jsondata = json_info.group(1) if json_info else None
|
||||||
|
if jsondata:
|
||||||
|
idx = jsondata.rfind('}]')
|
||||||
|
if idx > 0:
|
||||||
|
jsondata = jsondata[:idx + 2]
|
||||||
|
|
||||||
# log.debug(u'jsondata: %s' % jsondata)
|
# log.debug(u'jsondata: %s' % jsondata)
|
||||||
dataLayer = json.loads(jsondata) if jsondata else None
|
dataLayer = json.loads(jsondata) if jsondata else None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user