2 from __future__ import unicode_literals
6 from .turner import TurnerBaseIE
7 from ..utils import extract_attributes
10 class TBSIE(TurnerBaseIE):
11 _VALID_URL = r'https?://(?:www\.)?(?P<site>tbs|tntdrama)\.com/videos/(?:[^/]+/)+(?P<id>[^/?#]+)\.html'
13 'url': 'http://www.tbs.com/videos/people-of-earth/season-1/extras/2007318/theatrical-trailer.html',
14 'md5': '9e61d680e2285066ade7199e6408b2ee',
18 'title': 'Theatrical Trailer',
19 'description': 'Catch the latest comedy from TBS, People of Earth, premiering Halloween night--Monday, October 31, at 9/8c.',
22 'url': 'http://www.tntdrama.com/videos/good-behavior/season-1/extras/1538823/you-better-run.html',
23 'md5': 'ce53c6ead5e9f3280b4ad2031a6fab56',
27 'title': 'You Better Run',
28 '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.',
32 def _real_extract(self, url):
33 domain, display_id = re.match(self._VALID_URL, url).groups()
35 webpage = self._download_webpage(url, display_id)
36 video_params = extract_attributes(self._search_regex(r'(<[^>]+id="page-video"[^>]*>)', webpage, 'video params'))
38 clip_id = video_params.get('clipid')
40 query = 'id=' + clip_id
42 query = 'titleId=' + video_params['titleid']
43 return self._extract_cvp_info(
44 'http://www.%s.com/service/cvpXml?%s' % (domain, query), display_id, {
46 'media_src': 'http://ht.cdn.turner.com/%s/big' % site,
49 'media_src': 'http://androidhls-secure.cdn.turner.com/%s/big' % site,
50 'tokenizer_src': 'http://www.%s.com/video/processors/services/token_ipadAdobe.do' % domain,
54 'site_name': site.upper(),
55 'auth_required': video_params.get('isAuthRequired') != 'false',