mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-01 03:56:21 +02:00
[ie/afreecatv] Fix login and use legacy_ssl
(#10440)
Fixes regression in e8352ad659
due to cookies bug in curl_cffi < 0.7.1
Closes #10438
Authored by: bashonly
This commit is contained in:
parent
bacd18b7df
commit
4cd4146924
@ -1,6 +1,7 @@
|
|||||||
import functools
|
import functools
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..networking import Request
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
OnDemandPagedList,
|
OnDemandPagedList,
|
||||||
@ -58,6 +59,13 @@ def _perform_login(self, username, password):
|
|||||||
f'Unable to login: {self.IE_NAME} said: {error}',
|
f'Unable to login: {self.IE_NAME} said: {error}',
|
||||||
expected=True)
|
expected=True)
|
||||||
|
|
||||||
|
def _call_api(self, endpoint, display_id, data=None, headers=None, query=None):
|
||||||
|
return self._download_json(Request(
|
||||||
|
f'https://api.m.afreecatv.com/{endpoint}',
|
||||||
|
data=data, headers=headers, query=query,
|
||||||
|
extensions={'legacy_ssl': True}), display_id,
|
||||||
|
'Downloading API JSON', 'Unable to download API JSON')
|
||||||
|
|
||||||
|
|
||||||
class AfreecaTVIE(AfreecaTVBaseIE):
|
class AfreecaTVIE(AfreecaTVBaseIE):
|
||||||
IE_NAME = 'afreecatv'
|
IE_NAME = 'afreecatv'
|
||||||
@ -184,12 +192,12 @@ class AfreecaTVIE(AfreecaTVBaseIE):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
data = self._download_json(
|
data = self._call_api(
|
||||||
'https://api.m.afreecatv.com/station/video/a/view', video_id,
|
'station/video/a/view', video_id, headers={'Referer': url},
|
||||||
headers={'Referer': url}, data=urlencode_postdata({
|
data=urlencode_postdata({
|
||||||
'nTitleNo': video_id,
|
'nTitleNo': video_id,
|
||||||
'nApiLevel': 10,
|
'nApiLevel': 10,
|
||||||
}), impersonate=True)['data']
|
}))['data']
|
||||||
|
|
||||||
error_code = traverse_obj(data, ('code', {int}))
|
error_code = traverse_obj(data, ('code', {int}))
|
||||||
if error_code == -6221:
|
if error_code == -6221:
|
||||||
@ -267,9 +275,9 @@ class AfreecaTVCatchStoryIE(AfreecaTVBaseIE):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
data = self._download_json(
|
data = self._call_api(
|
||||||
'https://api.m.afreecatv.com/catchstory/a/view', video_id, headers={'Referer': url},
|
'catchstory/a/view', video_id, headers={'Referer': url},
|
||||||
query={'aStoryListIdx': '', 'nStoryIdx': video_id}, impersonate=True)
|
query={'aStoryListIdx': '', 'nStoryIdx': video_id})
|
||||||
|
|
||||||
return self.playlist_result(self._entries(data), video_id)
|
return self.playlist_result(self._entries(data), video_id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user