diff options
author | zackmark29 <62680932+zackmark29@users.noreply.github.com> | 2022-03-31 10:47:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-30 19:47:58 -0700 |
commit | c418e6b5a6aa483b801c29cf5ada4263e33a9a3e (patch) | |
tree | a13380f651d5f7a21cda2f1a55105f04c6f59c63 | |
parent | 11078c6d571673a0f09e21933f4ad1e6fcc35456 (diff) | |
download | hypervideo-pre-c418e6b5a6aa483b801c29cf5ada4263e33a9a3e.tar.lz hypervideo-pre-c418e6b5a6aa483b801c29cf5ada4263e33a9a3e.tar.xz hypervideo-pre-c418e6b5a6aa483b801c29cf5ada4263e33a9a3e.zip |
[viu] Fix bypass for preview (#3247)
Authored by: zackmark29
-rw-r--r-- | yt_dlp/extractor/viu.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/yt_dlp/extractor/viu.py b/yt_dlp/extractor/viu.py index b0a1fca68..ba627ca5b 100644 --- a/yt_dlp/extractor/viu.py +++ b/yt_dlp/extractor/viu.py @@ -329,7 +329,8 @@ class ViuOTTIE(InfoExtractor): if token is not None: query['identity'] = token else: - # preview is limited to 3min for non-members. But we can try to bypass it + # The content is Preview or for VIP only. + # We can try to bypass the duration which is limited to 3mins only duration_limit, query['duration'] = True, '180' try: stream_data = download_playback() @@ -346,13 +347,13 @@ class ViuOTTIE(InfoExtractor): # bypass preview duration limit if duration_limit: - stream_url = urllib.parse.urlparse(stream_url) + old_stream_url = urllib.parse.urlparse(stream_url) + query = dict(urllib.parse.parse_qsl(old_stream_url.query, keep_blank_values=True)) query.update({ 'duration': video_data.get('time_duration') or '9999999', 'duration_start': '0', }) - stream_url = stream_url._replace(query=urllib.parse.urlencode(dict( - urllib.parse.parse_qsl(stream_url.query, keep_blank_values=True)))).geturl() + stream_url = old_stream_url._replace(query=urllib.parse.urlencode(query)).geturl() formats.append({ 'format_id': vid_format, |