]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[facebook:plugins:video] Add extractor (Closes #10530)
authorSergey M․ <dstftw@gmail.com>
Fri, 2 Sep 2016 14:13:50 +0000 (21:13 +0700)
committerSergey M․ <dstftw@gmail.com>
Fri, 2 Sep 2016 14:13:50 +0000 (21:13 +0700)
youtube_dl/extractor/extractors.py
youtube_dl/extractor/facebook.py

index 2bcd5a0cdd8feeacb0951747fd904cd1ce7db18e..bc616223e81c5c3d996ad5a89611c784d88f8890 100644 (file)
@@ -264,7 +264,10 @@ from .everyonesmixtape import EveryonesMixtapeIE
 from .expotv import ExpoTVIE
 from .extremetube import ExtremeTubeIE
 from .eyedotv import EyedoTVIE
-from .facebook import FacebookIE
+from .facebook import (
+    FacebookIE,
+    FacebookPluginsVideoIE,
+)
 from .faz import FazIE
 from .fc2 import FC2IE
 from .fczenit import FczenitIE
index 228b0b6d740adc4038c77bb0f51eac3f0de858f1..3a220e9959f034224b42d199666b0523598bd8d9 100644 (file)
@@ -351,3 +351,32 @@ class FacebookIE(InfoExtractor):
                 self._VIDEO_PAGE_TEMPLATE % video_id,
                 video_id, fatal_if_no_video=True)
             return info_dict
+
+
+class FacebookPluginsVideoIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/plugins/video\.php\?.*?\bhref=(?P<id>https.+)'
+
+    _TESTS = [{
+        'url': 'https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Fgov.sg%2Fvideos%2F10154383743583686%2F&show_text=0&width=560',
+        'md5': '5954e92cdfe51fe5782ae9bda7058a07',
+        'info_dict': {
+            'id': '10154383743583686',
+            'ext': 'mp4',
+            'title': 'What to do during the haze?',
+            'uploader': 'Gov.sg',
+            'upload_date': '20160826',
+            'timestamp': 1472184808,
+        },
+        'add_ie': [FacebookIE.ie_key()],
+    }, {
+        'url': 'https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Fvideo.php%3Fv%3D10204634152394104',
+        'only_matching': True,
+    }, {
+        'url': 'https://www.facebook.com/plugins/video.php?href=https://www.facebook.com/gov.sg/videos/10154383743583686/&show_text=0&width=560',
+        'only_matching': True,
+    }]
+
+    def _real_extract(self, url):
+        return self.url_result(
+            compat_urllib_parse_unquote(self._match_id(url)),
+            FacebookIE.ie_key())