1 from __future__ import unicode_literals
3 from .common import InfoExtractor
5 from ..compat import compat_urlparse
6 from ..utils import qualities
9 class TheSceneIE(InfoExtractor):
10 _VALID_URL = r'https?://thescene\.com/watch/[^/]+/(?P<id>[^/#?]+)'
13 'url': 'https://thescene.com/watch/vogue/narciso-rodriguez-spring-2013-ready-to-wear',
15 'id': '520e8faac2b4c00e3c6e5f43',
17 'title': 'Narciso Rodriguez: Spring 2013 Ready-to-Wear',
18 'display_id': 'narciso-rodriguez-spring-2013-ready-to-wear',
22 def _real_extract(self, url):
23 display_id = self._match_id(url)
25 webpage = self._download_webpage(url, display_id)
27 player_url = compat_urlparse.urljoin(
29 self._html_search_regex(
30 r'id=\'js-player-script\'[^>]+src=\'(.+?)\'', webpage, 'player url'))
32 player = self._download_webpage(player_url, display_id)
33 info = self._parse_json(
35 r'(?m)var\s+video\s+=\s+({.+?});$', player, 'info json'),
38 qualities_order = qualities(('low', 'high'))
40 'format_id': '{0}-{1}'.format(f['type'].split('/')[0], f['quality']),
42 'quality': qualities_order(f['quality']),
43 } for f in info['sources'][0]]
44 self._sort_formats(formats)
48 'display_id': display_id,
49 'title': info['title'],
51 'thumbnail': info.get('poster_frame'),