A feature-rich command-line audio/video downloader
[Theta] Add video extractor (#1137)
Aleri Kaisattera0eaec13ba6ab
diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.pyindex 1776a4d268..8e8d269ced 100644--- a/yt_dlp/extractor/extractors.py+++ b/yt_dlp/extractor/extractors.py@@ -1433,7 +1433,10 @@ from .theplatform import (from .thescene import TheSceneIEfrom .thestar import TheStarIEfrom .thesun import TheSunIE-from .theta import ThetaIE+from .theta import (+ ThetaVideoIE,+ ThetaStreamIE,+)from .theweatherchannel import TheWeatherChannelIEfrom .thisamericanlife import ThisAmericanLifeIEfrom .thisav import ThisAVIEdiff --git a/yt_dlp/extractor/theta.py b/yt_dlp/extractor/theta.pyindex 34c0da8156..3b65436295 100644--- a/yt_dlp/extractor/theta.py+++ b/yt_dlp/extractor/theta.py@@ -5,8 +5,8 @@ from .common import InfoExtractorfrom ..utils import try_get-class ThetaIE(InfoExtractor):- _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'+class ThetaStreamIE(InfoExtractor):+ _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?!video/)(?P<id>[a-z0-9]+)'_TESTS = [{'url': 'https://www.theta.tv/davirus','skip': 'The live may have ended',@@ -49,3 +49,39 @@ class ThetaIE(InfoExtractor):'formats': formats,'thumbnail': try_get(info, lambda x: x['live_stream']['thumbnail_url']),}+++class ThetaVideoIE(InfoExtractor):+ _VALID_URL = r'https?://(?:www\.)?theta\.tv/video/(?P<id>vid[a-z0-9]+)'+ _TEST = {+ 'url': 'https://www.theta.tv/video/vidiq6aaet3kzf799p0',+ 'md5': '633d8c29eb276bb38a111dbd591c677f',+ 'info_dict': {+ 'id': 'vidiq6aaet3kzf799p0',+ 'ext': 'mp4',+ 'title': 'Theta EdgeCast Tutorial',+ 'uploader': 'Pixiekittie',+ 'description': 'md5:e316253f5bdced8b5a46bb50ae60a09f',+ 'thumbnail': r're:https://user-prod-theta-tv\.imgix\.net/.+/vod_thumb/.+.jpg',+ }+ }++ def _real_extract(self, url):+ video_id = self._match_id(url)+ info = self._download_json(f'https://api.theta.tv/v1/video/{video_id}/raw', video_id)['body']++ m3u8_playlist = try_get(info, lambda x: x['video_urls'][0]['url'])++ formats = self._extract_m3u8_formats(m3u8_playlist, video_id, 'mp4', m3u8_id='hls')+ self._sort_formats(formats)++ return {+ 'id': video_id,+ 'title': info.get('title'),+ 'uploader': try_get(info, lambda x: x['user']['username']),+ 'description': info.get('description'),+ 'view_count': info.get('view_count'),+ 'like_count': info.get('like_count'),+ 'formats': formats,+ 'thumbnail': info.get('thumbnail_url'),+ }