aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-11-13 15:07:48 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-11-13 15:14:22 +0530
commit92775d8a40728fe045af000755f1c3eeffb2089d (patch)
tree9ffcbfb5e2e61b3b10ffa072c5698e12d9930a04
parentdf03de2c02192e43e5b51c8708619179a268b4cf (diff)
downloadhypervideo-pre-92775d8a40728fe045af000755f1c3eeffb2089d.tar.lz
hypervideo-pre-92775d8a40728fe045af000755f1c3eeffb2089d.tar.xz
hypervideo-pre-92775d8a40728fe045af000755f1c3eeffb2089d.zip
[CuriosityStream] Fix series
Bug indroduced in ed807c18376ecb61c2219b506040bc3e9464bde9
-rw-r--r--yt_dlp/extractor/curiositystream.py56
-rw-r--r--yt_dlp/extractor/extractors.py3
2 files changed, 35 insertions, 24 deletions
diff --git a/yt_dlp/extractor/curiositystream.py b/yt_dlp/extractor/curiositystream.py
index 41c0f845a..628c83631 100644
--- a/yt_dlp/extractor/curiositystream.py
+++ b/yt_dlp/extractor/curiositystream.py
@@ -44,7 +44,7 @@ class CuriosityStreamBaseIE(InfoExtractor):
'password': password,
}))
self._handle_errors(result)
- self._auth_token = result['message']['auth_token']
+ CuriosityStreamBaseIE._auth_token = result['message']['auth_token']
class CuriosityStreamIE(CuriosityStreamBaseIE):
@@ -142,9 +142,26 @@ class CuriosityStreamIE(CuriosityStreamBaseIE):
}
-class CuriosityStreamCollectionIE(CuriosityStreamBaseIE):
- IE_NAME = 'curiositystream:collection'
- _VALID_URL = r'https?://(?:app\.)?curiositystream\.com/(?:collections?|series)/(?P<id>\d+)'
+class CuriosityStreamCollectionBaseIE(CuriosityStreamBaseIE):
+
+ def _real_extract(self, url):
+ collection_id = self._match_id(url)
+ collection = self._call_api(collection_id, collection_id)
+ entries = []
+ for media in collection.get('media', []):
+ media_id = compat_str(media.get('id'))
+ media_type, ie = ('series', CuriosityStreamSeriesIE) if media.get('is_collection') else ('video', CuriosityStreamIE)
+ entries.append(self.url_result(
+ 'https://curiositystream.com/%s/%s' % (media_type, media_id),
+ ie=ie.ie_key(), video_id=media_id))
+ return self.playlist_result(
+ entries, collection_id,
+ collection.get('title'), collection.get('description'))
+
+
+class CuriosityStreamCollectionsIE(CuriosityStreamCollectionBaseIE):
+ IE_NAME = 'curiositystream:collections'
+ _VALID_URL = r'https?://(?:app\.)?curiositystream\.com/collections/(?P<id>\d+)'
_API_BASE_URL = 'https://api.curiositystream.com/v2/collections/'
_TESTS = [{
'url': 'https://curiositystream.com/collections/86',
@@ -155,7 +172,17 @@ class CuriosityStreamCollectionIE(CuriosityStreamBaseIE):
},
'playlist_mincount': 7,
}, {
- 'url': 'https://app.curiositystream.com/collection/2',
+ 'url': 'https://curiositystream.com/collections/36',
+ 'only_matching': True,
+ }]
+
+
+class CuriosityStreamSeriesIE(CuriosityStreamCollectionBaseIE):
+ IE_NAME = 'curiositystream:series'
+ _VALID_URL = r'https?://(?:app\.)?curiositystream\.com/(?:series|collection)/(?P<id>\d+)'
+ _API_BASE_URL = 'https://api.curiositystream.com/v2/series/'
+ _TESTS = [{
+ 'url': 'https://curiositystream.com/series/2',
'info_dict': {
'id': '2',
'title': 'Curious Minds: The Internet',
@@ -163,23 +190,6 @@ class CuriosityStreamCollectionIE(CuriosityStreamBaseIE):
},
'playlist_mincount': 16,
}, {
- 'url': 'https://curiositystream.com/series/2',
- 'only_matching': True,
- }, {
- 'url': 'https://curiositystream.com/collections/36',
+ 'url': 'https://curiositystream.com/collection/2',
'only_matching': True,
}]
-
- def _real_extract(self, url):
- collection_id = self._match_id(url)
- collection = self._call_api(collection_id, collection_id)
- entries = []
- for media in collection.get('media', []):
- media_id = compat_str(media.get('id'))
- media_type, ie = ('series', CuriosityStreamCollectionIE) if media.get('is_collection') else ('video', CuriosityStreamIE)
- entries.append(self.url_result(
- 'https://curiositystream.com/%s/%s' % (media_type, media_id),
- ie=ie.ie_key(), video_id=media_id))
- return self.playlist_result(
- entries, collection_id,
- collection.get('title'), collection.get('description'))
diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py
index 4f9de71e2..2eee2a864 100644
--- a/yt_dlp/extractor/extractors.py
+++ b/yt_dlp/extractor/extractors.py
@@ -307,7 +307,8 @@ from .ctvnews import CTVNewsIE
from .cultureunplugged import CultureUnpluggedIE
from .curiositystream import (
CuriosityStreamIE,
- CuriosityStreamCollectionIE,
+ CuriosityStreamCollectionsIE,
+ CuriosityStreamSeriesIE,
)
from .cwtv import CWTVIE
from .dailymail import DailyMailIE