我想在python中从youtube下载私人电影:
#!/usr/bin/python
import os
import youtube_dl
ydl = youtube_dl.YoutubeDL({'outtmpl': '%(id)s%(ext)s','username':'XYYXYX','password':'XXXXX'})
with ydl:
result = ydl.extract_info(
'https://www.youtube.com/watch?v=privatevideoid',
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 = result
video_url = video['url']
但我得到的只是错误:此视频是私有的。
怎么做?