mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 01:25:11 +00:00
[dailymotion] use compat_struct_pack
This commit is contained in:
parent
f15f7a674b
commit
18d66f0410
1 changed files with 2 additions and 3 deletions
|
@ -8,10 +8,9 @@
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import struct
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_struct_pack
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
error_to_compat_str,
|
error_to_compat_str,
|
||||||
|
@ -177,7 +176,7 @@ def _real_extract(self, url):
|
||||||
r = int(metadata['id'][1:], 36)
|
r = int(metadata['id'][1:], 36)
|
||||||
us64e = lambda x: base64.urlsafe_b64encode(x).decode().strip('=')
|
us64e = lambda x: base64.urlsafe_b64encode(x).decode().strip('=')
|
||||||
t = ''.join(random.choice(string.ascii_letters) for i in range(10))
|
t = ''.join(random.choice(string.ascii_letters) for i in range(10))
|
||||||
n = us64e(struct.pack('I', r))
|
n = us64e(compat_struct_pack('I', r))
|
||||||
i = us64e(hashlib.md5(('%s%d%s' % (password, r, t)).encode()).digest())
|
i = us64e(hashlib.md5(('%s%d%s' % (password, r, t)).encode()).digest())
|
||||||
metadata = self._download_json(
|
metadata = self._download_json(
|
||||||
'http://www.dailymotion.com/player/metadata/video/p' + i + t + n, video_id)
|
'http://www.dailymotion.com/player/metadata/video/p' + i + t + n, video_id)
|
||||||
|
|
Loading…
Reference in a new issue