我有以下一段 python 代碼,它調(diào)用 youtube-dl 并提取我需要的鏈接。ydl = youtube_dl.YoutubeDL({'outtmpl': '%(id)s%(ext)s'})with ydl: result = ydl.extract_info( url, download=False # We just want to extract the info )if 'entries' in result: # Can be a playlist or a list of videos video = result['entries'][0]else: # Just a video video = resultif video: return videoreturn None但是我想在這個程序中使用自定義的 User-Agent。我知道我可以在命令行中使用 youtube-dl 時指定自定義用戶代理。有什么方法可以在嵌入 youtube-dl 的程序中指定自定義用戶代理。謝謝
添加回答
舉報
0/150
提交
取消