1
0
mirror of https://github.com/l1ving/youtube-dl synced 2020-11-18 19:53:54 -08:00

Update facebook.py

This commit is contained in:
ajj8 2020-03-19 12:00:23 +00:00 committed by GitHub
parent 388df88920
commit 772f93a75d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -516,6 +516,7 @@ class FacebookPluginsVideoIE(InfoExtractor):
class FacebookUserIE(InfoExtractor): class FacebookUserIE(InfoExtractor):
_VALID_URL = r'(?P<url>https?://(?:[^/]+\.)?facebook\.com/(?:pg/)?(?P<id>[^/?#&]+))/videos(?!/[\w\.])' _VALID_URL = r'(?P<url>https?://(?:[^/]+\.)?facebook\.com/(?:pg/)?(?P<id>[^/?#&]+))/videos(?!/[\w\.])'
IE_NAME = "facebook:user"
_TESTS = [{ _TESTS = [{
# page # page
@ -556,15 +557,14 @@ class FacebookUserIE(InfoExtractor):
if fb_url_mobj.group('type') == 'page': if fb_url_mobj.group('type') == 'page':
endpoint = 'PagesVideoHubVideoContainerPagelet' endpoint = 'PagesVideoHubVideoContainerPagelet'
a_class = '_5asm'
data = { data = {
'page': page_id 'page': page_id
} }
page_re = r'<td[^>]+>.+?<a href="(?P<url>[^"]+)".+?</td>'
elif fb_url_mobj.group('type') == 'profile': elif fb_url_mobj.group('type') == 'profile':
if not (fb_dtsg_ag and pagelet_token and collection_token): if not (fb_dtsg_ag and pagelet_token and collection_token):
raise ExtractorError('You must be logged in to extract profile videos', expected=True) raise ExtractorError('You must be logged in to extract profile videos', expected=True)
endpoint = 'VideosByUserAppCollectionPagelet' endpoint = 'VideosByUserAppCollectionPagelet'
a_class = '_400z'
data = { data = {
'collection_token': collection_token, 'collection_token': collection_token,
'disablepager': False, 'disablepager': False,
@ -574,6 +574,7 @@ class FacebookUserIE(InfoExtractor):
'order': None, 'order': None,
'sk': 'videos' 'sk': 'videos'
} }
page_re = r'<li[^>]+><a href="(?P<url>[^"]+)".+?</li>'
for page_num in itertools.count(1): for page_num in itertools.count(1):
js_data_page = self._download_webpage( js_data_page = self._download_webpage(
@ -594,8 +595,7 @@ class FacebookUserIE(InfoExtractor):
user_id, fatal=True) user_id, fatal=True)
for video in re.findall( for video in re.findall(
r'href="(?P<url>[^"]+)"[^>]+%s' % a_class, page_re, js_data['payload']):
js_data['payload']):
entries.append( entries.append(
self.url_result( self.url_result(
'https://www.facebook.com%s' % video, 'https://www.facebook.com%s' % video,