2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import unsmuggle_url
10 class JWPlatformIE(InfoExtractor):
11 _VALID_URL = r'(?:https?://(?:content\.jwplatform|cdn\.jwplayer)\.com/(?:(?:feed|player|thumb|preview)s|jw6|v2/media)/|jwplatform:)(?P<id>[a-zA-Z0-9]{8})'
13 'url': 'http://content.jwplatform.com/players/nPripu9l-ALJ3XQCI.js',
14 'md5': 'fa8899fa601eb7c83a64e9d568bdf325',
18 'title': 'Big Buck Bunny Trailer',
19 'description': 'Big Buck Bunny is a short animated film by the Blender Institute. It is made using free and open source software.',
20 'upload_date': '20081127',
21 'timestamp': 1227796140,
24 'url': 'https://cdn.jwplayer.com/players/nPripu9l-ALJ3XQCI.js',
25 'only_matching': True,
29 def _extract_url(webpage):
30 urls = JWPlatformIE._extract_urls(webpage)
31 return urls[0] if urls else None
34 def _extract_urls(webpage):
36 r'<(?:script|iframe)[^>]+?src=["\']((?:https?:)?//(?:content\.jwplatform|cdn\.jwplayer)\.com/players/[a-zA-Z0-9]{8})',
39 def _real_extract(self, url):
40 url, smuggled_data = unsmuggle_url(url, {})
41 self._initialize_geo_bypass({
42 'countries': smuggled_data.get('geo_countries'),
44 video_id = self._match_id(url)
45 json_data = self._download_json('https://cdn.jwplayer.com/v2/media/' + video_id, video_id)
46 return self._parse_jwplayer_data(json_data, video_id)