diff options
author | Sergey M․ <dstftw@gmail.com> | 2017-06-27 22:25:34 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2017-06-27 22:38:54 +0700 |
commit | 0646e34c7d511a02d8d93e840bceaa3521c2204e (patch) | |
tree | 939e82fb750cf3c18f2e4047987c365072ffa53e /youtube_dl/extractor/facebook.py | |
parent | bf2dc9cc6e1ca38955f646b67f0f6ec40aec139d (diff) |
[facebook] Add support for plugin video embeds and multiple embeds (closes #13493)
Diffstat (limited to 'youtube_dl/extractor/facebook.py')
-rw-r--r-- | youtube_dl/extractor/facebook.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py index b69c1ede0..4b3f6cc86 100644 --- a/youtube_dl/extractor/facebook.py +++ b/youtube_dl/extractor/facebook.py @@ -203,19 +203,19 @@ class FacebookIE(InfoExtractor): }] @staticmethod - def _extract_url(webpage): - mobj = re.search( - r'<iframe[^>]+?src=(["\'])(?P<url>https://www\.facebook\.com/video/embed.+?)\1', webpage) - if mobj is not None: - return mobj.group('url') - + def _extract_urls(webpage): + urls = [] + for mobj in re.finditer( + r'<iframe[^>]+?src=(["\'])(?P<url>https?://www\.facebook\.com/(?:video/embed|plugins/video\.php).+?)\1', + webpage): + urls.append(mobj.group('url')) # Facebook API embed # see https://developers.facebook.com/docs/plugins/embedded-video-player - mobj = re.search(r'''(?x)<div[^>]+ + for mobj in re.finditer(r'''(?x)<div[^>]+ class=(?P<q1>[\'"])[^\'"]*\bfb-(?:video|post)\b[^\'"]*(?P=q1)[^>]+ - data-href=(?P<q2>[\'"])(?P<url>(?:https?:)?//(?:www\.)?facebook.com/.+?)(?P=q2)''', webpage) - if mobj is not None: - return mobj.group('url') + data-href=(?P<q2>[\'"])(?P<url>(?:https?:)?//(?:www\.)?facebook.com/.+?)(?P=q2)''', webpage): + urls.append(mobj.group('url')) + return urls def _login(self): (useremail, password) = self._get_login_info() |