[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / vh1.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .mtv import MTVServicesInfoExtractor
5
6
7 class VH1IE(MTVServicesInfoExtractor):
8     IE_NAME = 'vh1.com'
9     _FEED_URL = 'http://www.vh1.com/feeds/mrss/'
10     _TESTS = [{
11         'url': 'http://www.vh1.com/episodes/0umwpq/hip-hop-squares-kent-jones-vs-nick-young-season-1-ep-120',
12         'info_dict': {
13             'title': 'Kent Jones vs. Nick Young',
14             'description': 'Come to Play. Stay to Party. With Mike Epps, TIP, O’Shea Jackson Jr., T-Pain, Tisha Campbell-Martin and more.',
15         },
16         'playlist_mincount': 4,
17     }, {
18         # Clip
19         'url': 'http://www.vh1.com/video-clips/t74mif/scared-famous-scared-famous-extended-preview',
20         'info_dict': {
21             'id': '0a50c2d2-a86b-4141-9565-911c7e2d0b92',
22             'ext': 'mp4',
23             'title': 'Scared Famous|October 9, 2017|1|NO-EPISODE#|Scared Famous + Extended Preview',
24             'description': 'md5:eff5551a274c473a29463de40f7b09da',
25             'upload_date': '20171009',
26             'timestamp': 1507574700,
27         },
28         'params': {
29             # m3u8 download
30             'skip_download': True,
31         },
32     }]
33
34     _VALID_URL = r'https?://(?:www\.)?vh1\.com/(?:video-clips|episodes)/(?P<id>[^/?#.]+)'
35
36     def _real_extract(self, url):
37         playlist_id = self._match_id(url)
38         webpage = self._download_webpage(url, playlist_id)
39         mgid = self._extract_triforce_mgid(webpage)
40         videos_info = self._get_videos_info(mgid)
41         return videos_info