Merge branch 'master' of github.com:rg3/youtube-dl into weibo
[ytdl] / youtube_dl / extractor / sonyliv.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 SonyLIVIE(InfoExtractor):
9     _VALID_URL = r'https?://(?:www\.)?sonyliv\.com/details/[^/]+/(?P<id>\d+)'
10     _TESTS = [{
11         'url': "http://www.sonyliv.com/details/episodes/5024612095001/Ep.-1---Achaari-Cheese-Toast---Bachelor's-Delight",
12         'info_dict': {
13             'title': "Ep. 1 - Achaari Cheese Toast - Bachelor's Delight",
14             'id': 'ref:5024612095001',
15             'ext': 'mp4',
16             'upload_date': '20170923',
17             'description': 'md5:7f28509a148d5be9d0782b4d5106410d',
18             'uploader_id': '5182475815001',
19             'timestamp': 1506200547,
20         },
21         'params': {
22             'skip_download': True,
23         },
24         'add_ie': ['BrightcoveNew'],
25     }, {
26         'url': 'http://www.sonyliv.com/details/full%20movie/4951168986001/Sei-Raat-(Bangla)',
27         'only_matching': True,
28     }]
29
30     # BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/4338955589001/default_default/index.html?videoId=%s'
31     BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/5182475815001/default_default/index.html?videoId=ref:%s'
32
33     def _real_extract(self, url):
34         brightcove_id = self._match_id(url)
35         return self.url_result(
36             smuggle_url(self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, {'geo_countries': ['IN']}),
37             'BrightcoveNew', brightcove_id)