1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-11 03:51:20 +00:00

Import from compat

This commit is contained in:
Bart Broere 2023-03-31 12:39:11 +02:00
parent 3b31478dfd
commit b4776f2e36

View file

@ -1,13 +1,13 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
import urllib.parse
from http.cookies import SimpleCookie
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import ( from ..compat import (
compat_HTTPError, compat_HTTPError,
compat_str, compat_str,
compat_urllib_parse_unquote_plus,
compat_cookies_SimpleCookie,
) )
from ..utils import ( from ..utils import (
determine_ext, determine_ext,
@ -192,7 +192,7 @@ class NPOIE(NPOBaseIE):
'Referer': url, 'Referer': url,
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
}) })
cookies = SimpleCookie() cookies = compat_cookies_SimpleCookie()
cookies.load(xsrf_token_response.headers['Set-Cookie']) cookies.load(xsrf_token_response.headers['Set-Cookie'])
cookies = {k: v.value for k, v in cookies.items()} cookies = {k: v.value for k, v in cookies.items()}
xsrf_token = cookies['XSRF-TOKEN'] xsrf_token = cookies['XSRF-TOKEN']
@ -200,7 +200,7 @@ class NPOIE(NPOBaseIE):
player = self._download_json( player = self._download_json(
'https://www.npostart.nl/player/%s' % video_id, video_id, 'https://www.npostart.nl/player/%s' % video_id, video_id,
'Downloading player JSON', 'Downloading player JSON',
headers={"x-xsrf-token": urllib.parse.unquote(xsrf_token)}, headers={"x-xsrf-token": compat_urllib_parse_unquote_plus(xsrf_token)},
data=urlencode_postdata({ data=urlencode_postdata({
'autoplay': 0, 'autoplay': 0,
'share': 1, 'share': 1,