0

I need to pass the YouTube video url and need to get all the available download format of that video. (I'm achieving this using the ydlp.extract_info(url, download=False) method.)

Then from the all available formats, I need to filter and select a particular format. for example, I need a video with resolution=720p, video without audio type and extension=webm. (For this, I'm filtering the results of ydlp.extract_info(url, download=False) and selecting the particular format)

Now, I need to pass this selected format to a function and download the video. And I also need to pass the output filepath & filename. I tried, ydlp.process_ie_result method but I'm getting an error while running.

import yt_dlp

ydlp = yt_dlp.YoutubeDL()

url = 'https://www.youtube.com/watch?v=d95PPykB2vE'

video_info = ydlp.extract_info(url, download=False)
formats = video_info['formats']

# selecting a random format for now
formats = formats[5]

ydlp.process_ie_result(formats, download=True)

But if I run this program, I getting this error,

 raise ExtractorError('Missing "id" field in extractor result', ie=info_dict['extractor'])
                                                                      ~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'extractor'

I'm using yt-dlp version 2023.06.22

In pytube we can,

  • get all available streams for a video
  • filter a selected stream that we need to download and
  • download that stream.

Basically I'm trying to achieve this using yt-dlp

rangarajan
  • 143
  • 5
  • 17

0 Answers0