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