]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/bravotv.py
541c769445796c5388743fd739f0823ca3228fb6
[youtubedl] / youtube_dl / extractor / bravotv.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import smuggle_url
6
7
8 class BravoTVIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?bravotv\.com/(?:[^/]+/)+videos/(?P<id>[^/?]+)'
10 _TEST = {
11 'url': 'http://www.bravotv.com/last-chance-kitchen/season-5/videos/lck-ep-12-fishy-finale',
12 'md5': 'd60cdf68904e854fac669bd26cccf801',
13 'info_dict': {
14 'id': 'LitrBdX64qLn',
15 'ext': 'mp4',
16 'title': 'Last Chance Kitchen Returns',
17 'description': 'S13: Last Chance Kitchen Returns for Top Chef Season 13',
18 'timestamp': 1448926740,
19 'upload_date': '20151130',
20 'uploader': 'NBCU-BRAV',
21 }
22 }
23
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
26 webpage = self._download_webpage(url, video_id)
27 account_pid = self._search_regex(r'"account_pid"\s*:\s*"([^"]+)"', webpage, 'account pid')
28 release_pid = self._search_regex(r'"release_pid"\s*:\s*"([^"]+)"', webpage, 'release pid')
29 return self.url_result(smuggle_url(
30 'http://link.theplatform.com/s/%s/%s?mbr=true&switch=progressive' % (account_pid, release_pid),
31 {'force_smil_url': True}), 'ThePlatform', release_pid)