79316665

Date: 2024-12-30 02:13:38
Score: 1
Natty:
Report link

I test your code. The reason of slow is there are some invalid URLs in the playlist, which causes yt_dlp have to retry. You can control the retry times by parameter skip_playlist_after_errors.

Please refer code below:

import yt_dlp
url = 'https://www.youtube.com/playlist?list=PLyiJZcChPSpxLQHGf6K5CwGv7QIR55ea6'

def get_video_info(url):
    # Use dump_single_json to output JSON
    # Assign -1 to skip_playlist_after_errors to do not retry 
    ydl_opts = {"ignoreerrors": True, "dump_single_json": True, "skip_playlist_after_errors":-1}
    with yt_dlp.YoutubeDL(ydl_opts) as ydl:
        info = ydl.extract_info(url, download=False)
    return info
info = get_video_info(url)
print()
print(info.get('entries'))
Reasons:
  • Blacklisted phrase (1): youtube.com
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: kougazhang