]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tastytrade.py
debian/control: Verify compliance with Policy 4.1.4 (no changes needed).
[youtubedl] / youtube_dl / extractor / tastytrade.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from .ooyala import OoyalaIE
5
6
7 class TastyTradeIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?tastytrade\.com/tt/shows/[^/]+/episodes/(?P<id>[^/?#&]+)'
9
10 _TESTS = [{
11 'url': 'https://www.tastytrade.com/tt/shows/market-measures/episodes/correlation-in-short-volatility-06-28-2017',
12 'info_dict': {
13 'id': 'F3bnlzbToeI6pLEfRyrlfooIILUjz4nM',
14 'ext': 'mp4',
15 'title': 'A History of Teaming',
16 'description': 'md5:2a9033db8da81f2edffa4c99888140b3',
17 'duration': 422.255,
18 },
19 'params': {
20 'skip_download': True,
21 },
22 'add_ie': ['Ooyala'],
23 }, {
24 'url': 'https://www.tastytrade.com/tt/shows/daily-dose/episodes/daily-dose-06-30-2017',
25 'only_matching': True,
26 }]
27
28 def _real_extract(self, url):
29 display_id = self._match_id(url)
30 webpage = self._download_webpage(url, display_id)
31
32 ooyala_code = self._search_regex(
33 r'data-media-id=(["\'])(?P<code>(?:(?!\1).)+)\1',
34 webpage, 'ooyala code', group='code')
35
36 info = self._search_json_ld(webpage, display_id, fatal=False)
37 info.update({
38 '_type': 'url_transparent',
39 'ie_key': OoyalaIE.ie_key(),
40 'url': 'ooyala:%s' % ooyala_code,
41 'display_id': display_id,
42 })
43 return info