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.

43 lines
1.6 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from .brightcove import BrightcoveLegacyIE
  6. from ..compat import (
  7. compat_parse_qs,
  8. compat_urlparse,
  9. )
  10. class TlcDeIE(InfoExtractor):
  11. IE_NAME = 'tlc.de'
  12. _VALID_URL = r'https?://(?:www\.)?tlc\.de/(?:[^/]+/)*videos/(?P<title>[^/?#]+)?(?:.*#(?P<id>\d+))?'
  13. _TEST = {
  14. 'url': 'http://www.tlc.de/sendungen/breaking-amish/videos/#3235167922001',
  15. 'info_dict': {
  16. 'id': '3235167922001',
  17. 'ext': 'mp4',
  18. 'title': 'Breaking Amish: Die Welt da draußen',
  19. 'description': (
  20. 'Vier Amische und eine Mennonitin wagen in New York'
  21. ' den Sprung in ein komplett anderes Leben. Begleitet sie auf'
  22. ' ihrem spannenden Weg.'),
  23. 'timestamp': 1396598084,
  24. 'upload_date': '20140404',
  25. 'uploader_id': '1659832546',
  26. },
  27. }
  28. BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1659832546/default_default/index.html?videoId=%s'
  29. def _real_extract(self, url):
  30. mobj = re.match(self._VALID_URL, url)
  31. brightcove_id = mobj.group('id')
  32. if not brightcove_id:
  33. title = mobj.group('title')
  34. webpage = self._download_webpage(url, title)
  35. brightcove_legacy_url = BrightcoveLegacyIE._extract_brightcove_url(webpage)
  36. brightcove_id = compat_parse_qs(compat_urlparse.urlparse(brightcove_legacy_url).query)['@videoPlayer'][0]
  37. return self.url_result(self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew', brightcove_id)