diff options
| author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-04-28 11:50:17 +0530 | 
|---|---|---|
| committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-04-28 19:29:33 +0530 | 
| commit | ef39f8600a290f1176d13f11894ab35df47ec9d8 (patch) | |
| tree | 05277650f053018454d5b4ae6b9063c2960a8b36 | |
| parent | 2291dbce2a1aa9c5e9e060eb7ac306f037234eb1 (diff) | |
| download | hypervideo-pre-ef39f8600a290f1176d13f11894ab35df47ec9d8.tar.lz hypervideo-pre-ef39f8600a290f1176d13f11894ab35df47ec9d8.tar.xz hypervideo-pre-ef39f8600a290f1176d13f11894ab35df47ec9d8.zip | |
[curiositystream] Fix collections
Closes #277
* A bug with authentication was reported in <https://github.com/yt-dlp/yt-dlp/issues/277#issuecomment-828254721> but cannot be tested without an account
| -rw-r--r-- | yt_dlp/extractor/curiositystream.py | 43 | ||||
| -rw-r--r-- | yt_dlp/extractor/extractors.py | 3 | 
2 files changed, 30 insertions, 16 deletions
| diff --git a/yt_dlp/extractor/curiositystream.py b/yt_dlp/extractor/curiositystream.py index ae64a07d7..c33430a88 100644 --- a/yt_dlp/extractor/curiositystream.py +++ b/yt_dlp/extractor/curiositystream.py @@ -143,32 +143,45 @@ class CuriosityStreamIE(CuriosityStreamBaseIE):          } -class CuriosityStreamCollectionIE(CuriosityStreamBaseIE): -    IE_NAME = 'curiositystream:collection' -    _VALID_URL = r'https?://(?:app\.)?curiositystream\.com/(?:collection|series)/(?P<id>\d+)' +class CuriosityStreamCollectionsIE(CuriosityStreamBaseIE): +    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://app.curiositystream.com/collection/2', +        'url': 'https://curiositystream.com/collections/86',          'info_dict': { -            'id': '2', -            'title': 'Curious Minds: The Internet', -            'description': 'How is the internet shaping our lives in the 21st Century?', +            'id': '86', +            'title': 'Staff Picks', +            'description': 'Wondering where to start? Here are a few of our favorite series and films... from our couch to yours.',          }, -        'playlist_mincount': 16, -    }, { -        'url': 'https://curiositystream.com/series/2', -        'only_matching': True, +        'playlist_mincount': 7,      }]      def _real_extract(self, url):          collection_id = self._match_id(url) -        collection = self._call_api( -            'collections/' + collection_id, collection_id) +        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/video/' + media_id, -                CuriosityStreamIE.ie_key(), media_id)) +                '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 CuriosityStreamSeriesIE(CuriosityStreamCollectionsIE): +    IE_NAME = 'curiositystream:series' +    _VALID_URL = r'https?://(?:app\.)?curiositystream\.com/series/(?P<id>\d+)' +    _API_BASE_URL = 'https://api.curiositystream.com/v2/series/' +    _TESTS = [{ +        'url': 'https://app.curiositystream.com/series/2', +        'info_dict': { +            'id': '2', +            'title': 'Curious Minds: The Internet', +            'description': 'How is the internet shaping our lives in the 21st Century?', +        }, +        'playlist_mincount': 16, +    }] diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py index 86089f36f..bd3655e6d 100644 --- a/yt_dlp/extractor/extractors.py +++ b/yt_dlp/extractor/extractors.py @@ -288,7 +288,8 @@ from .ctvnews import CTVNewsIE  from .cultureunplugged import CultureUnpluggedIE  from .curiositystream import (      CuriosityStreamIE, -    CuriosityStreamCollectionIE, +    CuriosityStreamCollectionsIE, +    CuriosityStreamSeriesIE,  )  from .cwtv import CWTVIE  from .dailymail import DailyMailIE | 
