You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .turner import TurnerBaseIE
  5. from ..utils import extract_attributes
  6. class TBSIE(TurnerBaseIE):
  7. # https://github.com/rg3/youtube-dl/issues/13658
  8. _WORKING = False
  9. _VALID_URL = r'https?://(?:www\.)?(?P<site>tbs|tntdrama)\.com/videos/(?:[^/]+/)+(?P<id>[^/?#]+)\.html'
  10. _TESTS = [{
  11. 'url': 'http://www.tbs.com/videos/people-of-earth/season-1/extras/2007318/theatrical-trailer.html',
  12. 'md5': '9e61d680e2285066ade7199e6408b2ee',
  13. 'info_dict': {
  14. 'id': '2007318',
  15. 'ext': 'mp4',
  16. 'title': 'Theatrical Trailer',
  17. 'description': 'Catch the latest comedy from TBS, People of Earth, premiering Halloween night--Monday, October 31, at 9/8c.',
  18. },
  19. 'skip': 'TBS videos are deleted after a while',
  20. }, {
  21. 'url': 'http://www.tntdrama.com/videos/good-behavior/season-1/extras/1538823/you-better-run.html',
  22. 'md5': 'ce53c6ead5e9f3280b4ad2031a6fab56',
  23. 'info_dict': {
  24. 'id': '1538823',
  25. 'ext': 'mp4',
  26. 'title': 'You Better Run',
  27. '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.',
  28. },
  29. 'skip': 'TBS videos are deleted after a while',
  30. }]
  31. def _real_extract(self, url):
  32. domain, display_id = re.match(self._VALID_URL, url).groups()
  33. site = domain[:3]
  34. webpage = self._download_webpage(url, display_id)
  35. video_params = extract_attributes(self._search_regex(r'(<[^>]+id="page-video"[^>]*>)', webpage, 'video params'))
  36. query = None
  37. clip_id = video_params.get('clipid')
  38. if clip_id:
  39. query = 'id=' + clip_id
  40. else:
  41. query = 'titleId=' + video_params['titleid']
  42. return self._extract_cvp_info(
  43. 'http://www.%s.com/service/cvpXml?%s' % (domain, query), display_id, {
  44. 'default': {
  45. 'media_src': 'http://ht.cdn.turner.com/%s/big' % site,
  46. },
  47. 'secure': {
  48. 'media_src': 'http://androidhls-secure.cdn.turner.com/%s/big' % site,
  49. 'tokenizer_src': 'http://www.%s.com/video/processors/services/token_ipadAdobe.do' % domain,
  50. },
  51. }, {
  52. 'url': url,
  53. 'site_name': site.upper(),
  54. 'auth_required': video_params.get('isAuthRequired') != 'false',
  55. })