[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / thescene.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5 from ..compat import compat_urlparse
6
7
8 class TheSceneIE(InfoExtractor):
9     _VALID_URL = r'https?://thescene\.com/watch/[^/]+/(?P<id>[^/#?]+)'
10
11     _TEST = {
12         'url': 'https://thescene.com/watch/vogue/narciso-rodriguez-spring-2013-ready-to-wear',
13         'info_dict': {
14             'id': '520e8faac2b4c00e3c6e5f43',
15             'ext': 'mp4',
16             'title': 'Narciso Rodriguez: Spring 2013 Ready-to-Wear',
17             'display_id': 'narciso-rodriguez-spring-2013-ready-to-wear',
18             'duration': 127,
19             'series': 'Style.com Fashion Shows',
20             'season': 'Ready To Wear Spring 2013',
21             'tags': list,
22             'categories': list,
23             'upload_date': '20120913',
24             'timestamp': 1347512400,
25             'uploader': 'vogue',
26         },
27     }
28
29     def _real_extract(self, url):
30         display_id = self._match_id(url)
31
32         webpage = self._download_webpage(url, display_id)
33
34         player_url = compat_urlparse.urljoin(
35             url,
36             self._html_search_regex(
37                 r'id=\'js-player-script\'[^>]+src=\'(.+?)\'', webpage, 'player url'))
38
39         return {
40             '_type': 'url_transparent',
41             'display_id': display_id,
42             'url': player_url,
43             'ie_key': 'CondeNast',
44         }