aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/facebook.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-01-25 22:18:34 +0600
committerSergey M․ <dstftw@gmail.com>2016-01-25 22:18:34 +0600
commitde691a498dd334ee5f8d237a4fc7ced314d86f44 (patch)
tree03f3417ff5a45af5a5dd382ea0514ef726571a98 /youtube_dl/extractor/facebook.py
parent2e6e742c3cda5ed4846bff4ef894aac21434e3d4 (diff)
[facebook:post] Add extractor (Closes #8321)
Diffstat (limited to 'youtube_dl/extractor/facebook.py')
-rw-r--r--youtube_dl/extractor/facebook.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py
index f9fd8ed4e..cb5dd57fb 100644
--- a/youtube_dl/extractor/facebook.py
+++ b/youtube_dl/extractor/facebook.py
@@ -199,3 +199,33 @@ class FacebookIE(InfoExtractor):
'formats': formats,
'uploader': uploader,
}
+
+
+class FacebookPostIE(InfoExtractor):
+ IE_NAME = 'facebook:post'
+ _VALID_URL = r'https?://(?:\w+\.)?facebook\.com/[^/]+/posts/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'https://www.facebook.com/maxlayn/posts/10153807558977570',
+ 'md5': '037b1fa7f3c2d02b7a0d7bc16031ecc6',
+ 'info_dict': {
+ 'id': '544765982287235',
+ 'ext': 'mp4',
+ 'title': '"What are you doing running in the snow?"',
+ 'uploader': 'FailArmy',
+ }
+ }
+
+ def _real_extract(self, url):
+ post_id = self._match_id(url)
+
+ webpage = self._download_webpage(url, post_id)
+
+ entries = [
+ self.url_result('facebook:%s' % video_id, FacebookIE.ie_key())
+ for video_id in self._parse_json(
+ self._search_regex(
+ r'(["\'])video_ids\1\s*:\s*(?P<ids>\[.+?\])',
+ webpage, 'video ids', group='ids'),
+ post_id)]
+
+ return self.playlist_result(entries, post_id)