about summary refs log tree commit diff
path: root/youtube_dl/extractor/digg.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2018-01-10 21:24:22 +0700
committerSergey M․ <dstftw@gmail.com>2018-01-10 21:24:22 +0700
commite654829b4c4b8ebd4efb4554dd02cc1418c6fc23 (patch)
tree79c4c07309c4965d85898c1e8b257c6660b3edb2 /youtube_dl/extractor/digg.py
parent2b4e1ace4ac422acbe63be2f8cc23429de6812b8 (diff)
downloadyoutube-dl-e654829b4c4b8ebd4efb4554dd02cc1418c6fc23.tar.gz
youtube-dl-e654829b4c4b8ebd4efb4554dd02cc1418c6fc23.tar.xz
youtube-dl-e654829b4c4b8ebd4efb4554dd02cc1418c6fc23.zip
[digg] Add extractor (closes #15214)
Diffstat (limited to 'youtube_dl/extractor/digg.py')
-rw-r--r--youtube_dl/extractor/digg.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/youtube_dl/extractor/digg.py b/youtube_dl/extractor/digg.py
new file mode 100644
index 000000000..611134ac0
--- /dev/null
+++ b/youtube_dl/extractor/digg.py
@@ -0,0 +1,41 @@
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class DiggIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?digg\.com/video/(?P<id>[^/?#&]+)'
+    _TEST = {
+        'url': 'http://digg.com/video/sci-fi-short-jonah-daniel-kaluuya-get-out',
+        'info_dict': {
+            'id': 'LcqvmS0b',
+            'ext': 'mp4',
+            'title': "'Get Out' Star Daniel Kaluuya Goes On 'Moby Dick'-Like Journey In Sci-Fi Short 'Jonah'",
+            'description': 'md5:541bb847648b6ee3d6514bc84b82efda',
+            'upload_date': '20180109',
+            'timestamp': 1515530551,
+        },
+        'params': {
+            'skip_download': True,
+        },
+    }
+
+    def _real_extract(self, url):
+        display_id = self._match_id(url)
+
+        webpage = self._download_webpage(url, display_id)
+
+        jwplatform_id = self._search_regex(
+            r'video_id\s*:\s*["\']([a-zA-Z0-9]{8})', webpage, 'jwplatform id',
+            default=None)
+
+        if not jwplatform_id:
+            return self.url_result(url, 'Generic')
+
+        return {
+            '_type': 'url_transparent',
+            'ie_key': 'JWPlatform',
+            'url': 'jwplatform:%s' % jwplatform_id,
+            'id': jwplatform_id,
+            'display_id': display_id,
+        }