0

For those of you who have used youtube -dl in python I am sure you seen

[youtube:search_url] playlist a: Downloading 20 videos

Is there anyway I can change the setting to download more than 20 videos, let say 100?

Here is my sample code

user_input_terms =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

 for x in range(0, len(user_input_terms)):  
logger.msg(user_input_terms)
ydl_opts = {
    'outtmpl': '{}.%(ext)s'.format(user_input_terms[x]),
    'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],
 }

try:
    with youtube_dl.YoutubeDL(ydl_opts,({'format':'137'})) as ydl:
        term = user_input_terms

        ydl.download([f"https://www.youtube.com/results?sp=EgQIBCgB&q={term}"])


except download_error:
    logger.msg("Youtube outputs a mp4 error.")
Mystery Man
  • 535
  • 2
  • 7
  • 20
  • Be careful about using `except` like that, see, for example https://stackoverflow.com/questions/54948548/what-is-wrong-with-using-a-bare-except. – AMC Mar 10 '20 at 22:08
  • @AMC Is there anyway I can change the setting to download more than 20 videos, let say 100? – Mystery Man Mar 10 '20 at 22:13
  • Do you know the name of the setting/parameter? I'm not familiar with the library, so I'm trying to find it in the docs. – AMC Mar 10 '20 at 22:19
  • @AMC https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/YoutubeDL.py The thing is I've been trying to look for a parameter that can solve it but I cannot find it. I appreciate your help – Mystery Man Mar 10 '20 at 22:23

0 Answers0