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-01-15 15:59:23 +00:00 committed by GitHub
parent f99698f45d
commit 0c4a0205c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -518,13 +518,15 @@ class FacebookUserIE(InfoExtractor):
_TESTS = [{ _TESTS = [{
# page # page
'url': 'https://www.facebook.com/uniladmag/videos' 'url': 'https://www.facebook.com/Coca-Cola/videos/?ref=page_internal',
'info_dict': {
'id': 'Coca-Cola'
},
'playlist_mincount': 90,
}, { }, {
# page # profile (requires login)
'url': 'https://www.facebook.com/Coca-Cola/videos/?ref=page_internal' 'url': 'https://www.facebook.com/zuck/videos',
}, { 'only_matching': True,
# profile
'url': 'https://www.facebook.com/zuck/videos'
}] }]
def _real_extract(self, url): def _real_extract(self, url):
@ -556,7 +558,7 @@ class FacebookUserIE(InfoExtractor):
a_class = '_5asm' a_class = '_5asm'
data = { data = {
'page': page_id 'page': page_id
} }
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)
@ -570,7 +572,7 @@ class FacebookUserIE(InfoExtractor):
'pagelet_token': pagelet_token, 'pagelet_token': pagelet_token,
'order': None, 'order': None,
'sk': 'videos' 'sk': 'videos'
} }
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(
@ -582,7 +584,7 @@ class FacebookUserIE(InfoExtractor):
{**data, 'cursor': cursor}, {**data, 'cursor': cursor},
separators=(',', ':')), separators=(',', ':')),
'__a': 1 '__a': 1
}) })
js_data = self._parse_json( js_data = self._parse_json(
self._search_regex( self._search_regex(
@ -591,8 +593,8 @@ 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, r'href="(?P<url>[^"]+)"[^>]+%s' % a_class,
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,