aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dlc/utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan@gmail.com>2021-01-20 00:35:50 +0530
committerpukkandan <pukkandan@gmail.com>2021-01-20 00:42:39 +0530
commit5c610515c90d090b66aa3d86be86fb06dff8457f (patch)
tree4e45688dff446de84bf65c386a723ca37e208a7f /youtube_dlc/utils.py
parent8a51f564395b79e66b7e6c61176337af57baa28a (diff)
downloadhypervideo-pre-5c610515c90d090b66aa3d86be86fb06dff8457f.tar.lz
hypervideo-pre-5c610515c90d090b66aa3d86be86fb06dff8457f.tar.xz
hypervideo-pre-5c610515c90d090b66aa3d86be86fb06dff8457f.zip
[TrovoLive] Add extractor (partially fix #20)
Only VOD extractor has been implemented Related: https://github.com/ytdl-org/youtube-dl/issues/26125 Related: https://github.com/blackjack4494/yt-dlc/issues/220
Diffstat (limited to 'youtube_dlc/utils.py')
-rw-r--r--youtube_dlc/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/youtube_dlc/utils.py b/youtube_dlc/utils.py
index a374a31bf..9ae105331 100644
--- a/youtube_dlc/utils.py
+++ b/youtube_dlc/utils.py
@@ -4099,7 +4099,8 @@ def strip_jsonp(code):
r'\g<callback_data>', code)
-def js_to_json(code):
+def js_to_json(code, vars={}):
+ # vars is a dict of var, val pairs to substitute
COMMENT_RE = r'/\*(?:(?!\*/).)*?\*/|//[^\n]*'
SKIP_RE = r'\s*(?:{comment})?\s*'.format(comment=COMMENT_RE)
INTEGER_TABLE = (
@@ -4128,6 +4129,9 @@ def js_to_json(code):
i = int(im.group(1), base)
return '"%d":' % i if v.endswith(':') else '%d' % i
+ if v in vars:
+ return vars[v]
+
return '"%s"' % v
return re.sub(r'''(?sx)