Reputation: 23
I'm trying to download just the thumbnail of a video and it does download the thumbnail but the video also downloads afterwards. I'm using this code:
thumbnail = folder + video["title"]
tn_options={
'format':'bestvideo',
'keepvideo':False,
'writethumbnail':'writethumbnail',
'outtmpl':thumbnail,}
with youtube_dl.YoutubeDL(tn_options) as ydl:
ydl.download([video['webpage_url']])
I assumed that setting keepvideo to False would prevent downloading the video as I've used it in the past but it's not working in this case.
Upvotes: 2
Views: 390
Reputation: 10319
The option to not download any video is called skip_download
. It would be like the following:
thumbnail = folder + video["title"]
tn_options={
'format': 'bestvideo',
'skip_download': True,
'writethumbnail': 'writethumbnail',
'outtmpl': thumbnail,
}
with youtube_dl.YoutubeDL(tn_options) as ydl:
ydl.download([video['webpage_url']])
keepvideo
is a post-processing video-only flag. If True
it means that it would keep the original video besides the post-processed one after finished.
From the docs:
Keep the video file on disk after the post-processing; the video is erased by default.
Upvotes: 2