1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-01 23:25:14 +00:00

[cleanup] Misc

This commit is contained in:
pukkandan
2022-07-18 04:26:50 +05:30
parent ce7f6aa660
commit c6e07cf1e1
10 changed files with 40 additions and 26 deletions

View File

@@ -1446,7 +1446,7 @@ from .rtbf import RTBFIE
from .rte import RteIE, RteRadioIE
from .rtlnl import (
RtlNlIE,
RTLLuTeleVODIE,
RTLLuTeleVODIE,
RTLLuArticleIE,
RTLLuLiveIE,
RTLLuRadioIE,

View File

@@ -931,9 +931,9 @@ class InfoExtractor:
def __print_error(self, errnote, fatal, video_id, err):
if fatal:
raise ExtractorError(f'{video_id}: {errnote} ', cause=err)
raise ExtractorError(f'{video_id}: {errnote}', cause=err)
elif errnote:
self.report_warning(f'{video_id}: {errnote} {err}')
self.report_warning(f'{video_id}: {errnote}: {err}')
def _parse_xml(self, xml_string, video_id, transform_source=None, fatal=True, errnote=None):
if transform_source:

View File

@@ -67,7 +67,7 @@ class MGTVIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
tk2 = base64.urlsafe_b64encode(
f'did={compat_str(uuid.uuid4()).encode()}|pno=1030|ver=0.3.0301|clit={int(time.time())}'.encode())[::-1]
f'did={str(uuid.uuid4())}|pno=1030|ver=0.3.0301|clit={int(time.time())}'.encode())[::-1]
try:
api_data = self._download_json(
'https://pcweb.api.mgtv.com/player/video', video_id, query={

View File

@@ -104,9 +104,8 @@ class PhantomJSwrapper:
self.exe = check_executable('phantomjs', ['-v'])
if not self.exe:
raise ExtractorError('PhantomJS executable not found in PATH, '
'download it from http://phantomjs.org',
expected=True)
raise ExtractorError(
'PhantomJS not found, Please download it from https://phantomjs.org/download.html', expected=True)
self.extractor = extractor

View File

@@ -1,7 +1,10 @@
from .common import InfoExtractor
from ..utils import (
ExtractorError, traverse_obj, parse_duration, unified_timestamp,
url_or_none
ExtractorError,
parse_duration,
traverse_obj,
unified_timestamp,
url_or_none,
)

View File

@@ -3,8 +3,8 @@ import re
import time
from .common import InfoExtractor
from ..aes import aes_cbc_encrypt
from ..utils import bytes_to_intlist, determine_ext, intlist_to_bytes, int_or_none, traverse_obj, urljoin
from ..aes import aes_cbc_encrypt_bytes
from ..utils import determine_ext, int_or_none, traverse_obj, urljoin
class WeTvBaseIE(InfoExtractor):
@@ -16,13 +16,11 @@ class WeTvBaseIE(InfoExtractor):
payload = (f'{video_id}|{int(time.time())}|mg3c3b04ba|{app_version}|0000000000000000|'
f'{platform}|{url[:48]}|{ua.lower()[:48]}||Mozilla|Netscape|Win32|00|')
ciphertext_int_bytes = aes_cbc_encrypt(
bytes_to_intlist(bytes(f'|{sum(map(ord, payload))}|{payload}', 'utf-8')),
bytes_to_intlist(b'Ok\xda\xa3\x9e/\x8c\xb0\x7f^r-\x9e\xde\xf3\x14'),
bytes_to_intlist(b'\x01PJ\xf3V\xe6\x19\xcf.B\xbb\xa6\x8c?p\xf9'),
'whitespace')
return intlist_to_bytes(ciphertext_int_bytes).hex()
return aes_cbc_encrypt_bytes(
bytes(f'|{sum(map(ord, payload))}|{payload}', 'utf-8'),
b'Ok\xda\xa3\x9e/\x8c\xb0\x7f^r-\x9e\xde\xf3\x14',
b'\x01PJ\xf3V\xe6\x19\xcf.B\xbb\xa6\x8c?p\xf9',
padding_mode='whitespace').hex()
def _get_video_api_response(self, video_url, video_id, series_id, subtitle_format, video_format, video_quality):
app_version = '3.5.57'