mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-27 19:39:38 +00:00
[ie/twitcasting] Fix password-protected livestream support (#13097)
Some checks are pending
CodeQL / Analyze (python) (push) Waiting to run
Download Tests / Quick Download Tests (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.13) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.10) (push) Waiting to run
Download Tests / Full Download Tests (windows-latest, 3.9) (push) Waiting to run
Download Tests / Full Download Tests (windows-latest, pypy-3.10) (push) Waiting to run
Quick Test / Core Test (push) Waiting to run
Quick Test / Code check (push) Waiting to run
Release (master) / release (push) Waiting to run
Release (master) / publish_pypi (push) Blocked by required conditions
Some checks are pending
CodeQL / Analyze (python) (push) Waiting to run
Download Tests / Quick Download Tests (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.13) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.10) (push) Waiting to run
Download Tests / Full Download Tests (windows-latest, 3.9) (push) Waiting to run
Download Tests / Full Download Tests (windows-latest, pypy-3.10) (push) Waiting to run
Quick Test / Core Test (push) Waiting to run
Quick Test / Code check (push) Waiting to run
Release (master) / release (push) Waiting to run
Release (master) / publish_pypi (push) Blocked by required conditions
Closes #13096 Authored by: bashonly
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import base64
|
import base64
|
||||||
|
import hashlib
|
||||||
import itertools
|
import itertools
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ from ..utils import (
|
|||||||
str_to_int,
|
str_to_int,
|
||||||
try_get,
|
try_get,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
|
update_url_query,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
urljoin,
|
urljoin,
|
||||||
@@ -171,6 +173,10 @@ class TwitCastingIE(InfoExtractor):
|
|||||||
'player': 'pc_web',
|
'player': 'pc_web',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
password_params = {
|
||||||
|
'word': hashlib.md5(video_password.encode()).hexdigest(),
|
||||||
|
} if video_password else None
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
# low: 640x360, medium: 1280x720, high: 1920x1080
|
# low: 640x360, medium: 1280x720, high: 1920x1080
|
||||||
qq = qualities(['low', 'medium', 'high'])
|
qq = qualities(['low', 'medium', 'high'])
|
||||||
@@ -178,7 +184,7 @@ class TwitCastingIE(InfoExtractor):
|
|||||||
'tc-hls', 'streams', {dict.items}, lambda _, v: url_or_none(v[1]),
|
'tc-hls', 'streams', {dict.items}, lambda _, v: url_or_none(v[1]),
|
||||||
)):
|
)):
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': m3u8_url,
|
'url': update_url_query(m3u8_url, password_params),
|
||||||
'format_id': f'hls-{quality}',
|
'format_id': f'hls-{quality}',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'quality': qq(quality),
|
'quality': qq(quality),
|
||||||
@@ -192,7 +198,7 @@ class TwitCastingIE(InfoExtractor):
|
|||||||
'llfmp4', 'streams', {dict.items}, lambda _, v: url_or_none(v[1]),
|
'llfmp4', 'streams', {dict.items}, lambda _, v: url_or_none(v[1]),
|
||||||
)):
|
)):
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': ws_url,
|
'url': update_url_query(ws_url, password_params),
|
||||||
'format_id': f'ws-{mode}',
|
'format_id': f'ws-{mode}',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'quality': qq(mode),
|
'quality': qq(mode),
|
||||||
|
Reference in New Issue
Block a user