From d2ff2c91bbac42e4d84131d7cf23d79c910d5309 Mon Sep 17 00:00:00 2001 From: monnef <1975567+mnn@users.noreply.github.com> Date: Fri, 27 May 2022 01:02:20 +0200 Subject: [curiositystream] Get `auth_token` from cookie (#3836) Closes #3753 Authored by: mnn --- yt_dlp/extractor/curiositystream.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'yt_dlp/extractor/curiositystream.py') diff --git a/yt_dlp/extractor/curiositystream.py b/yt_dlp/extractor/curiositystream.py index 5b76b29ff..e71b05289 100644 --- a/yt_dlp/extractor/curiositystream.py +++ b/yt_dlp/extractor/curiositystream.py @@ -23,6 +23,11 @@ class CuriosityStreamBaseIE(InfoExtractor): def _call_api(self, path, video_id, query=None): headers = {} + if not self._auth_token: + auth_cookie = self._get_cookies('https://curiositystream.com').get('auth_token') + if auth_cookie: + self.write_debug('Obtained auth_token cookie') + self._auth_token = cookie.value if self._auth_token: headers['X-Auth-Token'] = self._auth_token result = self._download_json( -- cgit v1.2.3 From 8a82af3511b4379af0d239dbd01c672c17a2c46a Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 27 May 2022 04:36:23 +0530 Subject: [cleanup] Misc fixes and cleanup Closes #3780, Closes #3853, Closes #3850 --- yt_dlp/extractor/curiositystream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yt_dlp/extractor/curiositystream.py') diff --git a/yt_dlp/extractor/curiositystream.py b/yt_dlp/extractor/curiositystream.py index e71b05289..be4e53e44 100644 --- a/yt_dlp/extractor/curiositystream.py +++ b/yt_dlp/extractor/curiositystream.py @@ -27,7 +27,7 @@ class CuriosityStreamBaseIE(InfoExtractor): auth_cookie = self._get_cookies('https://curiositystream.com').get('auth_token') if auth_cookie: self.write_debug('Obtained auth_token cookie') - self._auth_token = cookie.value + self._auth_token = auth_cookie.value if self._auth_token: headers['X-Auth-Token'] = self._auth_token result = self._download_json( -- cgit v1.2.3 From 14f25df2b6233553e968df023430ca96c0b1df9f Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 24 Jun 2022 16:24:43 +0530 Subject: [compat] Remove deprecated functions from core code --- yt_dlp/extractor/curiositystream.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'yt_dlp/extractor/curiositystream.py') diff --git a/yt_dlp/extractor/curiositystream.py b/yt_dlp/extractor/curiositystream.py index be4e53e44..a105b6ce2 100644 --- a/yt_dlp/extractor/curiositystream.py +++ b/yt_dlp/extractor/curiositystream.py @@ -1,12 +1,8 @@ import re from .common import InfoExtractor -from ..utils import ( - int_or_none, - urlencode_postdata, - compat_str, - ExtractorError, -) +from ..compat import compat_str +from ..utils import ExtractorError, int_or_none, urlencode_postdata class CuriosityStreamBaseIE(InfoExtractor): @@ -50,7 +46,7 @@ class CuriosityStreamIE(CuriosityStreamBaseIE): IE_NAME = 'curiositystream' _VALID_URL = r'https?://(?:app\.)?curiositystream\.com/video/(?P\d+)' _TESTS = [{ - 'url': 'https://app.curiositystream.com/video/2', + 'url': 'http://app.curiositystream.com/video/2', 'info_dict': { 'id': '2', 'ext': 'mp4', -- cgit v1.2.3