From e921ad845d29ed5a192dc6910b2457372ee27ec1 Mon Sep 17 00:00:00 2001 From: Avi Peretz Date: Mon, 14 Jan 2019 13:37:15 +0200 Subject: [PATCH 1/2] flake8 fixes --- youtube_dl/extractor/facebook.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py index 05ea8a473..b1847dd21 100644 --- a/youtube_dl/extractor/facebook.py +++ b/youtube_dl/extractor/facebook.py @@ -59,7 +59,6 @@ class FacebookIE(InfoExtractor): _VIDEO_PAGE_TEMPLATE = 'https://www.facebook.com/video/video.php?v=%s' _VIDEO_PAGE_TAHOE_TEMPLATE = 'https://www.facebook.com/video/tahoe/async/%s/?chain=true&isvideo=true&payloadtype=%s' - _TESTS = [{ 'url': 'https://www.facebook.com/video.php?v=637842556329505&fref=nf', 'md5': '6a40d33c0eccbb1af76cf0485a052659', @@ -358,7 +357,8 @@ class FacebookIE(InfoExtractor): # Video info not in first request, do a secondary request using # tahoe player specific URL - tahoe_request_data = urlencode_postdata({ + tahoe_request_data = urlencode_postdata( + { '__a': 1, '__pc': self._search_regex( r'pkg_cohort["\']\s*:\s*["\'](.+?)["\']', webpage, @@ -371,8 +371,8 @@ class FacebookIE(InfoExtractor): webpage, 'dtsg token', default=''), }) tahoe_request_headers = { - 'Content-Type': 'application/x-www-form-urlencoded', - } + 'Content-Type': 'application/x-www-form-urlencoded', + } tahoe_primary_data = self._download_webpage( self._VIDEO_PAGE_TAHOE_TEMPLATE % (video_id, 'primary'), video_id, From 5916a2fc38a505c06c8dbb585a06b6bd5fe324df Mon Sep 17 00:00:00 2001 From: Avi Peretz Date: Mon, 14 Jan 2019 16:05:59 +0200 Subject: [PATCH 2/2] read uploader id --- youtube_dl/extractor/facebook.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py index b1847dd21..d70837402 100644 --- a/youtube_dl/extractor/facebook.py +++ b/youtube_dl/extractor/facebook.py @@ -449,6 +449,12 @@ class FacebookIE(InfoExtractor): r'data-utime=\\\"(\d+)\\\"', tahoe_secondary_data, 'timestamp', default=None)) + uploader_id = self._search_regex( + r'ownerid:"([\d]+)', webpage, + 'uploader_id', default=None) or self._search_regex( + r'\"ownerid\":"(\d+)"', tahoe_secondary_data, + 'uploader_id', default=None) + thumbnail = self._og_search_thumbnail(webpage) view_count = parse_count(self._search_regex( @@ -463,6 +469,7 @@ class FacebookIE(InfoExtractor): 'timestamp': timestamp, 'thumbnail': thumbnail, 'view_count': view_count, + 'uploader_id': uploader_id } return webpage, info_dict