Youtube dl Python Set Headers
Youtube-dl can download videos in most situations; however, you may want to set headers.
In order to do that, you need to import youtube_dl.utils.
Here is the example!
import youtube_dl
import youtube_dl.utils
url = "https://www.youtube.com/watch?v=mvmuCPvRoWQ"
youtube_dl.utils.std_headers['Referer'] = "https://www.google.com/"
with youtube_dl.YoutubeDL({}) as ydl:
result = ydl.download([url])