Browse Source

Add extractor for thescene.com (closes #8929)

totalwebcasting
Jaime Marquínez Ferrándiz 9 years ago
parent
commit
7da2c87119
2 changed files with 49 additions and 0 deletions
  1. +1
    -0
      youtube_dl/extractor/__init__.py
  2. +48
    -0
      youtube_dl/extractor/thescene.py

+ 1
- 0
youtube_dl/extractor/__init__.py View File

@ -743,6 +743,7 @@ from .theplatform import (
ThePlatformIE,
ThePlatformFeedIE,
)
from .thescene import TheSceneIE
from .thesixtyone import TheSixtyOneIE
from .thestar import TheStarIE
from .thisamericanlife import ThisAmericanLifeIE


+ 48
- 0
youtube_dl/extractor/thescene.py View File

@ -0,0 +1,48 @@
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_urllib_parse
from ..utils import qualities
class TheSceneIE(InfoExtractor):
_VALID_URL = r'https://thescene\.com/watch/[^/]+/(?P<id>[^/#?]+)'
_TEST = {
'url': 'https://thescene.com/watch/vogue/narciso-rodriguez-spring-2013-ready-to-wear',
'info_dict': {
'id': '520e8faac2b4c00e3c6e5f43',
'ext': 'mp4',
'title': 'Narciso Rodriguez: Spring 2013 Ready-to-Wear',
'display_id': 'narciso-rodriguez-spring-2013-ready-to-wear',
},
}
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
player_url = compat_urllib_parse.urljoin(
url,
self._html_search_regex(
r'id=\'js-player-script\'[^>]+src=\'(.+?)\'', webpage, 'player url'))
self.to_screen(player_url)
player = self._download_webpage(player_url, player_url)
info = self._parse_json(self._search_regex(r'(?m)var\s+video\s+=\s+({.+?});$', player, 'info json'), display_id)
qualities_order = qualities(['low', 'high'])
formats = [{
'format_id': '{0}-{1}'.format(f['type'].split('/')[0], f['quality']),
'url': f['src'],
'quality': qualities_order(f['quality']),
} for f in info['sources'][0]]
self._sort_formats(formats)
return {
'id': info['id'],
'title': info['title'],
'formats': formats,
'thumbnail': info.get('poster_frame'),
'display_id': display_id,
}

Loading…
Cancel
Save