mirror of
https://codeberg.org/polarisfm/youtube-dl.git
synced 2024-12-25 01:01:39 +00:00
[jwplatform] Use js_to_json to detect more JWPlayers
This commit is contained in:
parent
c51a7f0b2f
commit
e14c82bd6b
2 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
version <unreleased>
|
||||||
|
|
||||||
|
Extractors
|
||||||
|
* [jwplatform] Improve JWPlayer detection
|
||||||
|
|
||||||
|
|
||||||
version 2016.09.15
|
version 2016.09.15
|
||||||
|
|
||||||
Core
|
Core
|
||||||
|
|
|
@ -9,6 +9,7 @@ from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
js_to_json,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,14 +20,15 @@ class JWPlatformBaseIE(InfoExtractor):
|
||||||
# TODO: Merge this with JWPlayer-related codes in generic.py
|
# TODO: Merge this with JWPlayer-related codes in generic.py
|
||||||
|
|
||||||
mobj = re.search(
|
mobj = re.search(
|
||||||
'jwplayer\((?P<quote>[\'"])[^\'" ]+(?P=quote)\)\.setup\((?P<options>[^)]+)\)',
|
r'jwplayer\((?P<quote>[\'"])[^\'" ]+(?P=quote)\)\.setup\s*\((?P<options>[^)]+)\)',
|
||||||
webpage)
|
webpage)
|
||||||
if mobj:
|
if mobj:
|
||||||
return mobj.group('options')
|
return mobj.group('options')
|
||||||
|
|
||||||
def _extract_jwplayer_data(self, webpage, video_id, *args, **kwargs):
|
def _extract_jwplayer_data(self, webpage, video_id, *args, **kwargs):
|
||||||
jwplayer_data = self._parse_json(
|
jwplayer_data = self._parse_json(
|
||||||
self._find_jwplayer_data(webpage), video_id)
|
self._find_jwplayer_data(webpage), video_id,
|
||||||
|
transform_source=js_to_json)
|
||||||
return self._parse_jwplayer_data(
|
return self._parse_jwplayer_data(
|
||||||
jwplayer_data, video_id, *args, **kwargs)
|
jwplayer_data, video_id, *args, **kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue