2024-03-31 18:01:09 -06:00
|
|
|
import base64
|
2017-05-13 08:51:58 -06:00
|
|
|
import re
|
2022-09-23 15:52:11 -06:00
|
|
|
import urllib.parse
|
2017-05-13 08:51:58 -06:00
|
|
|
|
2013-12-06 01:15:04 -07:00
|
|
|
from .common import InfoExtractor
|
2023-07-09 01:53:02 -06:00
|
|
|
from ..networking import HEADRequest
|
|
|
|
from ..networking.exceptions import HTTPError
|
2015-11-21 09:18:17 -07:00
|
|
|
from ..utils import (
|
|
|
|
ExtractorError,
|
2022-12-29 09:32:54 -07:00
|
|
|
determine_ext,
|
2024-09-26 17:21:03 -06:00
|
|
|
filter_dict,
|
2016-05-20 09:43:36 -06:00
|
|
|
float_or_none,
|
2021-01-01 05:26:37 -07:00
|
|
|
int_or_none,
|
2022-09-23 15:52:11 -06:00
|
|
|
parse_qs,
|
|
|
|
traverse_obj,
|
2021-01-01 05:26:37 -07:00
|
|
|
try_get,
|
2022-09-23 15:52:11 -06:00
|
|
|
update_url_query,
|
2022-12-29 09:32:54 -07:00
|
|
|
urlhandle_detect_ext,
|
2015-11-21 09:18:17 -07:00
|
|
|
)
|
2013-12-06 01:15:04 -07:00
|
|
|
|
|
|
|
|
2021-01-01 05:26:37 -07:00
|
|
|
class WistiaBaseIE(InfoExtractor):
|
|
|
|
_VALID_ID_REGEX = r'(?P<id>[a-z0-9]{10})'
|
2022-05-08 09:10:06 -06:00
|
|
|
_VALID_URL_BASE = r'https?://(?:\w+\.)?wistia\.(?:net|com)/(?:embed/)?'
|
2022-09-23 15:52:11 -06:00
|
|
|
_EMBED_BASE_URL = 'http://fast.wistia.net/embed/'
|
2013-12-06 01:15:04 -07:00
|
|
|
|
2021-01-01 05:26:37 -07:00
|
|
|
def _download_embed_config(self, config_type, config_id, referer):
|
2024-06-11 17:09:58 -06:00
|
|
|
base_url = self._EMBED_BASE_URL + f'{config_type}/{config_id}'
|
2024-09-26 17:21:03 -06:00
|
|
|
video_password = self.get_param('videopassword')
|
2021-01-01 05:26:37 -07:00
|
|
|
embed_config = self._download_json(
|
|
|
|
base_url + '.json', config_id, headers={
|
|
|
|
'Referer': referer if referer.startswith('http') else base_url, # Some videos require this.
|
2024-09-26 17:21:03 -06:00
|
|
|
}, query=filter_dict({'password': video_password}))
|
2016-05-20 08:55:10 -06:00
|
|
|
|
2022-09-23 15:52:11 -06:00
|
|
|
error = traverse_obj(embed_config, 'error')
|
|
|
|
if error:
|
2016-05-20 08:55:10 -06:00
|
|
|
raise ExtractorError(
|
2022-09-23 15:52:11 -06:00
|
|
|
f'Error while getting the playlist: {error}', expected=True)
|
2016-05-20 08:55:10 -06:00
|
|
|
|
2024-09-26 17:21:03 -06:00
|
|
|
if traverse_obj(embed_config, (
|
|
|
|
'media', ('embed_options', 'embedOptions'), 'plugin',
|
|
|
|
'passwordProtectedVideo', 'on', any)) == 'true':
|
|
|
|
if video_password:
|
|
|
|
raise ExtractorError('Invalid video password', expected=True)
|
|
|
|
raise ExtractorError(
|
|
|
|
'This content is password-protected. Use the --video-password option', expected=True)
|
|
|
|
|
2021-01-01 05:26:37 -07:00
|
|
|
return embed_config
|
|
|
|
|
2022-12-29 09:32:54 -07:00
|
|
|
def _get_real_ext(self, url):
|
|
|
|
ext = determine_ext(url, default_ext='bin')
|
|
|
|
if ext == 'bin':
|
|
|
|
urlh = self._request_webpage(
|
|
|
|
HEADRequest(url), None, note='Checking media extension',
|
|
|
|
errnote='HEAD request returned error', fatal=False)
|
|
|
|
if urlh:
|
|
|
|
ext = urlhandle_detect_ext(urlh, default='bin')
|
|
|
|
return 'mp4' if ext == 'mov' else ext
|
|
|
|
|
2021-01-01 05:26:37 -07:00
|
|
|
def _extract_media(self, embed_config):
|
|
|
|
data = embed_config['media']
|
|
|
|
video_id = data['hashedId']
|
2016-03-17 10:48:17 -06:00
|
|
|
title = data['name']
|
2013-12-06 01:15:04 -07:00
|
|
|
|
|
|
|
formats = []
|
|
|
|
thumbnails = []
|
2016-03-01 10:26:53 -07:00
|
|
|
for a in data['assets']:
|
2016-05-20 09:04:01 -06:00
|
|
|
aurl = a.get('url')
|
|
|
|
if not aurl:
|
|
|
|
continue
|
2016-03-17 10:48:17 -06:00
|
|
|
astatus = a.get('status')
|
2016-03-01 10:26:53 -07:00
|
|
|
atype = a.get('type')
|
2016-05-20 09:04:01 -06:00
|
|
|
if (astatus is not None and astatus != 2) or atype in ('preview', 'storyboard'):
|
2016-03-17 10:48:17 -06:00
|
|
|
continue
|
|
|
|
elif atype in ('still', 'still_image'):
|
2013-12-06 01:15:04 -07:00
|
|
|
thumbnails.append({
|
2022-12-29 09:32:54 -07:00
|
|
|
'url': aurl.replace('.bin', f'.{self._get_real_ext(aurl)}'),
|
2016-05-20 09:04:01 -06:00
|
|
|
'width': int_or_none(a.get('width')),
|
|
|
|
'height': int_or_none(a.get('height')),
|
2020-01-05 13:08:50 -07:00
|
|
|
'filesize': int_or_none(a.get('size')),
|
2013-12-06 01:15:04 -07:00
|
|
|
})
|
2016-03-17 10:48:17 -06:00
|
|
|
else:
|
2022-12-29 09:32:54 -07:00
|
|
|
aext = a.get('ext') or self._get_real_ext(aurl)
|
2020-01-05 13:08:50 -07:00
|
|
|
display_name = a.get('display_name')
|
|
|
|
format_id = atype
|
|
|
|
if atype and atype.endswith('_video') and display_name:
|
2024-06-11 17:09:58 -06:00
|
|
|
format_id = f'{atype[:-6]}-{display_name}'
|
2020-01-05 13:08:50 -07:00
|
|
|
f = {
|
|
|
|
'format_id': format_id,
|
2016-05-20 09:04:01 -06:00
|
|
|
'url': aurl,
|
2020-01-05 13:08:50 -07:00
|
|
|
'tbr': int_or_none(a.get('bitrate')) or None,
|
2021-02-18 15:03:16 -07:00
|
|
|
'quality': 1 if atype == 'original' else None,
|
2020-01-05 13:08:50 -07:00
|
|
|
}
|
|
|
|
if display_name == 'Audio':
|
|
|
|
f.update({
|
|
|
|
'vcodec': 'none',
|
|
|
|
})
|
|
|
|
else:
|
|
|
|
f.update({
|
|
|
|
'width': int_or_none(a.get('width')),
|
|
|
|
'height': int_or_none(a.get('height')),
|
|
|
|
'vcodec': a.get('codec'),
|
|
|
|
})
|
|
|
|
if a.get('container') == 'm3u8' or aext == 'm3u8':
|
|
|
|
ts_f = f.copy()
|
|
|
|
ts_f.update({
|
|
|
|
'ext': 'ts',
|
|
|
|
'format_id': f['format_id'].replace('hls-', 'ts-'),
|
|
|
|
'url': f['url'].replace('.bin', '.ts'),
|
|
|
|
})
|
|
|
|
formats.append(ts_f)
|
|
|
|
f.update({
|
|
|
|
'ext': 'mp4',
|
|
|
|
'protocol': 'm3u8_native',
|
|
|
|
})
|
|
|
|
else:
|
|
|
|
f.update({
|
|
|
|
'container': a.get('container'),
|
|
|
|
'ext': aext,
|
|
|
|
'filesize': int_or_none(a.get('size')),
|
|
|
|
})
|
|
|
|
formats.append(f)
|
2013-12-25 07:20:14 -07:00
|
|
|
|
2020-01-05 13:08:50 -07:00
|
|
|
subtitles = {}
|
|
|
|
for caption in data.get('captions', []):
|
|
|
|
language = caption.get('language')
|
|
|
|
if not language:
|
|
|
|
continue
|
|
|
|
subtitles[language] = [{
|
|
|
|
'url': self._EMBED_BASE_URL + 'captions/' + video_id + '.vtt?language=' + language,
|
|
|
|
}]
|
|
|
|
|
2013-12-06 01:15:04 -07:00
|
|
|
return {
|
|
|
|
'id': video_id,
|
2016-03-17 10:48:17 -06:00
|
|
|
'title': title,
|
|
|
|
'description': data.get('seoDescription'),
|
2013-12-06 01:15:04 -07:00
|
|
|
'formats': formats,
|
|
|
|
'thumbnails': thumbnails,
|
2016-05-20 09:43:36 -06:00
|
|
|
'duration': float_or_none(data.get('duration')),
|
2016-03-17 10:48:17 -06:00
|
|
|
'timestamp': int_or_none(data.get('createdAt')),
|
2020-01-05 13:08:50 -07:00
|
|
|
'subtitles': subtitles,
|
2013-12-06 01:15:04 -07:00
|
|
|
}
|
2021-01-01 05:26:37 -07:00
|
|
|
|
2022-09-23 15:52:11 -06:00
|
|
|
@classmethod
|
|
|
|
def _extract_from_webpage(cls, url, webpage):
|
|
|
|
from .teachable import TeachableIE
|
|
|
|
|
|
|
|
if list(TeachableIE._extract_embed_urls(url, webpage)):
|
|
|
|
return
|
|
|
|
|
|
|
|
yield from super()._extract_from_webpage(url, webpage)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _extract_wistia_async_embed(cls, webpage):
|
|
|
|
# https://wistia.com/support/embed-and-share/video-on-your-website
|
|
|
|
# https://wistia.com/support/embed-and-share/channel-embeds
|
|
|
|
yield from re.finditer(
|
|
|
|
r'''(?sx)
|
|
|
|
<(?:div|section)[^>]+class=([\"'])(?:(?!\1).)*?(?P<type>wistia[a-z_0-9]+)\s*\bwistia_async_(?P<id>[a-z0-9]{10})\b(?:(?!\1).)*?\1
|
|
|
|
''', webpage)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _extract_url_media_id(cls, url):
|
|
|
|
mobj = re.search(r'(?:wmediaid|wvideo(?:id)?)]?=(?P<id>[a-z0-9]{10})', urllib.parse.unquote_plus(url))
|
|
|
|
if mobj:
|
|
|
|
return mobj.group('id')
|
|
|
|
|
2021-01-01 05:26:37 -07:00
|
|
|
|
|
|
|
class WistiaIE(WistiaBaseIE):
|
2024-06-11 17:09:58 -06:00
|
|
|
_VALID_URL = rf'(?:wistia:|{WistiaBaseIE._VALID_URL_BASE}(?:iframe|medias)/){WistiaBaseIE._VALID_ID_REGEX}'
|
2022-09-23 15:52:11 -06:00
|
|
|
_EMBED_REGEX = [
|
|
|
|
r'''(?x)
|
|
|
|
<(?:meta[^>]+?content|(?:iframe|script)[^>]+?src)=["\']
|
|
|
|
(?P<url>(?:https?:)?//(?:fast\.)?wistia\.(?:net|com)/embed/(?:iframe|medias)/[a-z0-9]{10})
|
|
|
|
''']
|
2021-01-01 05:26:37 -07:00
|
|
|
_TESTS = [{
|
|
|
|
# with hls video
|
|
|
|
'url': 'wistia:807fafadvk',
|
|
|
|
'md5': 'daff0f3687a41d9a71b40e0e8c2610fe',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '807fafadvk',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Drip Brennan Dunn Workshop',
|
|
|
|
'description': 'a JV Webinars video',
|
|
|
|
'upload_date': '20160518',
|
|
|
|
'timestamp': 1463607249,
|
|
|
|
'duration': 4987.11,
|
|
|
|
},
|
2022-09-23 15:52:11 -06:00
|
|
|
'skip': 'video unavailable',
|
|
|
|
}, {
|
|
|
|
'url': 'wistia:a6ndpko1wg',
|
|
|
|
'md5': '10c1ce9c4dde638202513ed17a3767bd',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'a6ndpko1wg',
|
2022-12-29 09:32:54 -07:00
|
|
|
'ext': 'mp4',
|
2022-09-23 15:52:11 -06:00
|
|
|
'title': 'Episode 2: Boxed Water\'s retention is thirsty',
|
|
|
|
'upload_date': '20210324',
|
|
|
|
'description': 'md5:da5994c2c2d254833b412469d9666b7a',
|
|
|
|
'duration': 966.0,
|
|
|
|
'timestamp': 1616614369,
|
2022-12-29 09:32:54 -07:00
|
|
|
'thumbnail': 'https://embed-ssl.wistia.com/deliveries/53dc60239348dc9b9fba3755173ea4c2.png',
|
2024-06-11 17:09:58 -06:00
|
|
|
},
|
2022-09-21 14:53:08 -06:00
|
|
|
}, {
|
|
|
|
'url': 'wistia:5vd7p4bct5',
|
|
|
|
'md5': 'b9676d24bf30945d97060638fbfe77f0',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '5vd7p4bct5',
|
2022-12-29 09:32:54 -07:00
|
|
|
'ext': 'mp4',
|
2022-09-21 14:53:08 -06:00
|
|
|
'title': 'md5:eaa9f64c4efd7b5f098b9b6118597679',
|
|
|
|
'description': 'md5:a9bea0315f0616aa5df2dc413ddcdd0f',
|
|
|
|
'upload_date': '20220915',
|
|
|
|
'timestamp': 1663258727,
|
|
|
|
'duration': 623.019,
|
2022-12-29 09:32:54 -07:00
|
|
|
'thumbnail': r're:https?://embed(?:-ssl)?.wistia.com/.+\.jpg$',
|
2022-09-21 14:53:08 -06:00
|
|
|
},
|
2021-01-01 05:26:37 -07:00
|
|
|
}, {
|
|
|
|
'url': 'wistia:sh7fpupwlt',
|
|
|
|
'only_matching': True,
|
|
|
|
}, {
|
|
|
|
'url': 'http://fast.wistia.net/embed/iframe/sh7fpupwlt',
|
|
|
|
'only_matching': True,
|
|
|
|
}, {
|
|
|
|
'url': 'http://fast.wistia.com/embed/iframe/sh7fpupwlt',
|
|
|
|
'only_matching': True,
|
|
|
|
}, {
|
|
|
|
'url': 'http://fast.wistia.net/embed/medias/sh7fpupwlt.json',
|
|
|
|
'only_matching': True,
|
|
|
|
}]
|
|
|
|
|
2022-09-23 15:52:11 -06:00
|
|
|
_WEBPAGE_TESTS = [{
|
|
|
|
'url': 'https://www.weidert.com/blog/wistia-channels-video-marketing-tool',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'cqwukac3z1',
|
2022-12-29 09:32:54 -07:00
|
|
|
'ext': 'mp4',
|
2022-09-23 15:52:11 -06:00
|
|
|
'title': 'How Wistia Channels Can Help Capture Inbound Value From Your Video Content',
|
|
|
|
'duration': 158.125,
|
|
|
|
'timestamp': 1618974400,
|
|
|
|
'description': 'md5:27abc99a758573560be72600ef95cece',
|
|
|
|
'upload_date': '20210421',
|
2022-12-29 09:32:54 -07:00
|
|
|
'thumbnail': 'https://embed-ssl.wistia.com/deliveries/6c551820ae950cdee2306d6cbe9ef742.jpg',
|
2024-06-11 17:09:58 -06:00
|
|
|
},
|
2022-09-23 15:52:11 -06:00
|
|
|
}, {
|
|
|
|
'url': 'https://study.com/academy/lesson/north-american-exploration-failed-colonies-of-spain-france-england.html#lesson',
|
|
|
|
'md5': 'b9676d24bf30945d97060638fbfe77f0',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '5vd7p4bct5',
|
2022-12-29 09:32:54 -07:00
|
|
|
'ext': 'mp4',
|
2022-09-23 15:52:11 -06:00
|
|
|
'title': 'paywall_north-american-exploration-failed-colonies-of-spain-france-england',
|
|
|
|
'upload_date': '20220915',
|
|
|
|
'timestamp': 1663258727,
|
|
|
|
'duration': 623.019,
|
2022-12-29 09:32:54 -07:00
|
|
|
'thumbnail': 'https://embed-ssl.wistia.com/deliveries/83e6ec693e2c05a0ce65809cbaead86a.jpg',
|
2022-09-23 15:52:11 -06:00
|
|
|
'description': 'a Paywall Videos video',
|
|
|
|
},
|
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
embed_config = self._download_embed_config('medias', video_id, url)
|
|
|
|
return self._extract_media(embed_config)
|
|
|
|
|
2022-07-31 19:23:25 -06:00
|
|
|
@classmethod
|
|
|
|
def _extract_embed_urls(cls, url, webpage):
|
|
|
|
urls = list(super()._extract_embed_urls(url, webpage))
|
2022-09-23 15:52:11 -06:00
|
|
|
for match in cls._extract_wistia_async_embed(webpage):
|
|
|
|
if match.group('type') != 'wistia_channel':
|
2024-06-11 17:09:58 -06:00
|
|
|
urls.append('wistia:{}'.format(match.group('id')))
|
2022-09-23 15:52:11 -06:00
|
|
|
for match in re.finditer(r'(?:data-wistia-?id=["\']|Wistia\.embed\(["\']|id=["\']wistia_)(?P<id>[a-z0-9]{10})',
|
|
|
|
webpage):
|
2024-06-11 17:09:58 -06:00
|
|
|
urls.append('wistia:{}'.format(match.group('id')))
|
2022-09-23 15:52:11 -06:00
|
|
|
if not WistiaChannelIE._extract_embed_urls(url, webpage): # Fallback
|
|
|
|
media_id = cls._extract_url_media_id(url)
|
|
|
|
if media_id:
|
2024-06-11 17:09:58 -06:00
|
|
|
urls.append('wistia:{}'.format(match.group('id')))
|
2021-01-01 05:26:37 -07:00
|
|
|
return urls
|
|
|
|
|
|
|
|
|
|
|
|
class WistiaPlaylistIE(WistiaBaseIE):
|
2024-06-11 17:09:58 -06:00
|
|
|
_VALID_URL = rf'{WistiaBaseIE._VALID_URL_BASE}playlists/{WistiaBaseIE._VALID_ID_REGEX}'
|
2021-01-01 05:26:37 -07:00
|
|
|
|
|
|
|
_TEST = {
|
|
|
|
'url': 'https://fast.wistia.net/embed/playlists/aodt9etokc',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'aodt9etokc',
|
|
|
|
},
|
|
|
|
'playlist_count': 3,
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
playlist_id = self._match_id(url)
|
2022-09-23 15:52:11 -06:00
|
|
|
playlist = self._download_embed_config('playlists', playlist_id, url)
|
2021-01-01 05:26:37 -07:00
|
|
|
|
|
|
|
entries = []
|
|
|
|
for media in (try_get(playlist, lambda x: x[0]['medias']) or []):
|
|
|
|
embed_config = media.get('embed_config')
|
|
|
|
if not embed_config:
|
|
|
|
continue
|
|
|
|
entries.append(self._extract_media(embed_config))
|
|
|
|
|
|
|
|
return self.playlist_result(entries, playlist_id)
|
2022-09-23 15:52:11 -06:00
|
|
|
|
|
|
|
|
|
|
|
class WistiaChannelIE(WistiaBaseIE):
|
2024-06-11 17:09:58 -06:00
|
|
|
_VALID_URL = rf'(?:wistiachannel:|{WistiaBaseIE._VALID_URL_BASE}channel/){WistiaBaseIE._VALID_ID_REGEX}'
|
2022-09-23 15:52:11 -06:00
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
# JSON Embed API returns 403, should fall back to webpage
|
|
|
|
'url': 'https://fast.wistia.net/embed/channel/yvyvu7wjbg?wchannelid=yvyvu7wjbg',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'yvyvu7wjbg',
|
|
|
|
'title': 'Copysmith Tutorials and Education!',
|
2024-06-11 17:09:58 -06:00
|
|
|
'description': 'Learn all things Copysmith via short and informative videos!',
|
2022-09-23 15:52:11 -06:00
|
|
|
},
|
|
|
|
'playlist_mincount': 7,
|
|
|
|
'expected_warnings': ['falling back to webpage'],
|
|
|
|
}, {
|
|
|
|
'url': 'https://fast.wistia.net/embed/channel/3802iirk0l',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '3802iirk0l',
|
|
|
|
'title': 'The Roof',
|
|
|
|
},
|
|
|
|
'playlist_mincount': 20,
|
|
|
|
}, {
|
|
|
|
# link to popup video, follow --no-playlist
|
|
|
|
'url': 'https://fast.wistia.net/embed/channel/3802iirk0l?wchannelid=3802iirk0l&wmediaid=sp5dqjzw3n',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'sp5dqjzw3n',
|
2022-12-29 09:32:54 -07:00
|
|
|
'ext': 'mp4',
|
2022-09-23 15:52:11 -06:00
|
|
|
'title': 'The Roof S2: The Modern CRO',
|
2022-12-29 09:32:54 -07:00
|
|
|
'thumbnail': 'https://embed-ssl.wistia.com/deliveries/dadfa9233eaa505d5e0c85c23ff70741.png',
|
2022-09-23 15:52:11 -06:00
|
|
|
'duration': 86.487,
|
|
|
|
'description': 'A sales leader on The Roof? Man, they really must be letting anyone up here this season.\n',
|
|
|
|
'timestamp': 1619790290,
|
|
|
|
'upload_date': '20210430',
|
|
|
|
},
|
|
|
|
'params': {'noplaylist': True, 'skip_download': True},
|
|
|
|
}]
|
|
|
|
_WEBPAGE_TESTS = [{
|
|
|
|
'url': 'https://www.profitwell.com/recur/boxed-out',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '6jyvmqz6zs',
|
|
|
|
'title': 'Boxed Out',
|
|
|
|
'description': 'md5:14a8a93a1dbe236718e6a59f8c8c7bae',
|
|
|
|
},
|
|
|
|
'playlist_mincount': 30,
|
|
|
|
}, {
|
|
|
|
# section instead of div
|
|
|
|
'url': 'https://360learning.com/studio/onboarding-joei/',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'z874k93n2o',
|
|
|
|
'title': 'Onboarding Joei.',
|
|
|
|
'description': 'Coming to you weekly starting Feb 19th.',
|
|
|
|
},
|
|
|
|
'playlist_mincount': 20,
|
|
|
|
}, {
|
|
|
|
'url': 'https://amplitude.com/amplify-sessions?amp%5Bwmediaid%5D=pz0m0l0if3&%5Bwvideo%5D=pz0m0l0if3&wchannelid=emyjmwjf79&wmediaid=i8um783bdt',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'pz0m0l0if3',
|
|
|
|
'title': 'A Framework for Improving Product Team Performance',
|
2022-12-29 09:32:54 -07:00
|
|
|
'ext': 'mp4',
|
2022-09-23 15:52:11 -06:00
|
|
|
'timestamp': 1653935275,
|
|
|
|
'upload_date': '20220530',
|
|
|
|
'description': 'Learn how to help your company improve and achieve your product related goals.',
|
|
|
|
'duration': 1854.39,
|
2022-12-29 09:32:54 -07:00
|
|
|
'thumbnail': 'https://embed-ssl.wistia.com/deliveries/12fd19e56413d9d6f04e2185c16a6f8854e25226.png',
|
2022-09-23 15:52:11 -06:00
|
|
|
},
|
|
|
|
'params': {'noplaylist': True, 'skip_download': True},
|
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
channel_id = self._match_id(url)
|
|
|
|
media_id = self._extract_url_media_id(url)
|
|
|
|
if not self._yes_playlist(channel_id, media_id, playlist_label='channel'):
|
|
|
|
return self.url_result(f'wistia:{media_id}', 'Wistia')
|
|
|
|
|
|
|
|
try:
|
|
|
|
data = self._download_embed_config('channel', channel_id, url)
|
2023-07-09 01:53:02 -06:00
|
|
|
except (ExtractorError, HTTPError):
|
2022-09-23 15:52:11 -06:00
|
|
|
# Some channels give a 403 from the JSON API
|
|
|
|
self.report_warning('Failed to download channel data from API, falling back to webpage.')
|
|
|
|
webpage = self._download_webpage(f'https://fast.wistia.net/embed/channel/{channel_id}', channel_id)
|
|
|
|
data = self._parse_json(
|
2024-06-11 17:09:58 -06:00
|
|
|
self._search_regex(rf'wchanneljsonp-{channel_id}\'\]\s*=[^\"]*\"([A-Za-z0-9=/]*)', webpage, 'jsonp', channel_id),
|
2024-03-31 18:01:09 -06:00
|
|
|
channel_id, transform_source=lambda x: urllib.parse.unquote_plus(base64.b64decode(x).decode('utf-8')))
|
2022-09-23 15:52:11 -06:00
|
|
|
|
|
|
|
# XXX: can there be more than one series?
|
|
|
|
series = traverse_obj(data, ('series', 0), default={})
|
|
|
|
|
|
|
|
entries = [
|
|
|
|
self.url_result(f'wistia:{video["hashedId"]}', WistiaIE, title=video.get('name'))
|
|
|
|
for video in traverse_obj(series, ('sections', ..., 'videos', ...)) or []
|
|
|
|
if video.get('hashedId')
|
|
|
|
]
|
|
|
|
|
|
|
|
return self.playlist_result(
|
|
|
|
entries, channel_id, playlist_title=series.get('title'), playlist_description=series.get('description'))
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _extract_embed_urls(cls, url, webpage):
|
|
|
|
yield from super()._extract_embed_urls(url, webpage)
|
|
|
|
for match in cls._extract_wistia_async_embed(webpage):
|
|
|
|
if match.group('type') == 'wistia_channel':
|
|
|
|
# original url may contain wmediaid query param
|
|
|
|
yield update_url_query(f'wistiachannel:{match.group("id")}', parse_qs(url))
|