2 from __future__ import unicode_literals
6 from .turner import TurnerBaseIE
7 from ..utils import extract_attributes
10 class TBSIE(TurnerBaseIE):
11 # https://github.com/rg3/youtube-dl/issues/13658
14 _VALID_URL = r'https?://(?:www\.)?(?P<site>tbs|tntdrama)\.com/videos/(?:[^/]+/)+(?P<id>[^/?#]+)\.html'
16 'url': 'http://www.tbs.com/videos/people-of-earth/season-1/extras/2007318/theatrical-trailer.html',
17 'md5': '9e61d680e2285066ade7199e6408b2ee',
21 'title': 'Theatrical Trailer',
22 'description': 'Catch the latest comedy from TBS, People of Earth, premiering Halloween night--Monday, October 31, at 9/8c.',
24 'skip': 'TBS videos are deleted after a while',
26 'url': 'http://www.tntdrama.com/videos/good-behavior/season-1/extras/1538823/you-better-run.html',
27 'md5': 'ce53c6ead5e9f3280b4ad2031a6fab56',
31 'title': 'You Better Run',
32 'description': 'Letty Raines must figure out what she\'s running toward while running away from her past. Good Behavior premieres November 15 at 9/8c.',
34 'skip': 'TBS videos are deleted after a while',
37 def _real_extract(self, url):
38 domain, display_id = re.match(self._VALID_URL, url).groups()
40 webpage = self._download_webpage(url, display_id)
41 video_params = extract_attributes(self._search_regex(r'(<[^>]+id="page-video"[^>]*>)', webpage, 'video params'))
43 clip_id = video_params.get('clipid')
45 query = 'id=' + clip_id
47 query = 'titleId=' + video_params['titleid']
48 return self._extract_cvp_info(
49 'http://www.%s.com/service/cvpXml?%s' % (domain, query), display_id, {
51 'media_src': 'http://ht.cdn.turner.com/%s/big' % site,
54 'media_src': 'http://androidhls-secure.cdn.turner.com/%s/big' % site,
55 'tokenizer_src': 'http://www.%s.com/video/processors/services/token_ipadAdobe.do' % domain,
59 'site_name': site.upper(),
60 'auth_required': video_params.get('isAuthRequired') != 'false',