summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2019-10-19 23:56:36 +0700
committerSergey M․ <dstftw@gmail.com>2019-10-19 23:56:36 +0700
commit2297c0d7d977921dca865e6c9cbc7ee5282ba8ef (patch)
tree9c8e5ac60696e7c8c2f500d0f96574b3d35073f4
parent824fa51165d92ceee01589bf995ebbf009df328c (diff)
downloadyoutube-dl-2297c0d7d977921dca865e6c9cbc7ee5282ba8ef.tar.gz
youtube-dl-2297c0d7d977921dca865e6c9cbc7ee5282ba8ef.tar.xz
youtube-dl-2297c0d7d977921dca865e6c9cbc7ee5282ba8ef.zip
[facebook] Bypass download rate limits (closes #21018)
-rw-r--r--youtube_dl/extractor/facebook.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py
index a3dcdca3e..a56f85c21 100644
--- a/youtube_dl/extractor/facebook.py
+++ b/youtube_dl/extractor/facebook.py
@@ -405,6 +405,11 @@ class FacebookIE(InfoExtractor):
         if not formats:
             raise ExtractorError('Cannot find video formats')
 
+        # Downloads with browser's User-Agent are rate limited. Working around
+        # with non-browser User-Agent.
+        for f in formats:
+            f.setdefault('http_headers', {})['User-Agent'] = 'facebookexternalhit/1.1'
+
         self._sort_formats(formats)
 
         video_title = self._html_search_regex(