[instagram] use custom User-Agent header for video downloads

(#1682, #1623, #1580)
This commit is contained in:
Mike Fährmann
2021-08-05 22:26:47 +02:00
parent 7b029dfe85
commit 5d5ab669fa

View File

@@ -43,6 +43,7 @@ class InstagramExtractor(Extractor):
self.login()
data = self.metadata()
videos = self.config("videos", True)
video_headers = {"User-Agent": "Mozilla/5.0"}
for post in self.posts():
@@ -60,6 +61,8 @@ class InstagramExtractor(Extractor):
url = file["display_url"]
elif not videos:
continue
else:
file["_http_headers"] = video_headers
file.update(post)
yield Message.Url, url, text.nameext_from_url(url, file)