Here's my code using Python (simplified version):
import yt_dlp
YDL_OPTIONS = {
'format': 'bestaudio*',
'noplaylist': True,
}
with yt_dlp.YoutubeDL(YDL_OPTIONS) as ydl:
info = ydl.extract_info(url, download=False)
The problem comes up when the url directs to a playlist
(e.g. https://www.youtube.com/playlist?list=PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb)
Here's the output:
[youtube:tab] PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb: Downloading webpage
[youtube:tab] PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb: Downloading API JSON with unavailable videos
[download] Downloading playlist: C++
[youtube:tab] playlist C++: Downloading 100 videos
[download] Downloading video 1 of 100
[youtube] 18c3MTX0PK0: Downloading webpage
[youtube] 18c3MTX0PK0: Downloading android player API JSON
[download] Downloading video 2 of 100
[youtube] 1OsGXuNA5cc: Downloading webpage
[youtube] 1OsGXuNA5cc: Downloading android player API JSON
[download] Downloading video 3 of 100
[youtube] 1E_kBSka_ec: Downloading webpage
[youtube] 1E_kBSka_ec: Downloading android player API JSON
...
As you can see, the 'noplaylist' option didn't work in this case.
Is there an option or function making ydl
only extract one video info, for instance the first one, in the entire playlist?