1 from __future__ import unicode_literals
3 from .common import InfoExtractor
4 from ..utils import js_to_json
7 class DiggIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?digg\.com/video/(?P<id>[^/?#&]+)'
10 # JWPlatform via provider
11 'url': 'http://digg.com/video/sci-fi-short-jonah-daniel-kaluuya-get-out',
15 'title': "'Get Out' Star Daniel Kaluuya Goes On 'Moby Dick'-Like Journey In Sci-Fi Short 'Jonah'",
16 'description': 'md5:541bb847648b6ee3d6514bc84b82efda',
17 'upload_date': '20180109',
18 'timestamp': 1515530551,
21 'skip_download': True,
24 # Youtube via provider
25 'url': 'http://digg.com/video/dog-boat-seal-play',
26 'only_matching': True,
28 # vimeo as regular embed
29 'url': 'http://digg.com/video/dream-girl-short-film',
30 'only_matching': True,
33 def _real_extract(self, url):
34 display_id = self._match_id(url)
36 webpage = self._download_webpage(url, display_id)
38 info = self._parse_json(
40 r'(?s)video_info\s*=\s*({.+?});\n', webpage, 'video info',
41 default='{}'), display_id, transform_source=js_to_json,
44 video_id = info.get('video_id')
47 provider = info.get('provider_name')
48 if provider == 'youtube':
49 return self.url_result(
50 video_id, ie='Youtube', video_id=video_id)
51 elif provider == 'jwplayer':
52 return self.url_result(
53 'jwplatform:%s' % video_id, ie='JWPlatform',
56 return self.url_result(url, 'Generic')