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.

39 lines
1.5 KiB

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