How to download youtube playlist info using youtube-dl in a python program?
See original GitHub issueChecklist
- [x ] I’m asking a question
- [x ] I’ve looked through the README and FAQ for similar questions
- [x ] I’ve searched the bugtracker for similar questions including closed ones
Question
I’m trying to download info about all items in a youtube playlist. I’ve figured out the command to execute on the terminal but I’m unable to figure out its equivalent code when embedded in a python program.
Here’s the terminal command I use :
youtube-dl --dump-single-json --flat-playlist PLFftu4DSZBSwrGiOlZXKHRSoKArsKSuz9 > /Users/abhimanyu/Desktop/list.json
Here’s how far I got in embedded python :
import youtube_dl
ydl = youtube_dl.YoutubeDL({'dump_single_json': 'True',
'extract_flat' : 'True'})
with ydl:
result = ydl.download([
'https://www.youtube.com/playlist?list=PLFftu4DSZBSwrGiOlZXKHRSoKArsKSuz9'])
print(len(result))
I also tried ydl.extract_info
but that starts fetching info about each video individually which I don’t need.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Download Youtube Video(s) or whole Playlist with Python
Download Selected Video From YouTube Playlist · First, we will fetch all video link from the YouTube playlist using the pyyoutube module. ·...
Read more >youtube-dl only extract playlist info - Stack Overflow
You can import youtube_dl ,invoke youtube_dl as ydl and set download=False, here is an example download = False ydl_opts = { 'outtmpl': ...
Read more >YouTube download using youtube-dl embedded with Python
Downloading YouTube, Vimeo etc Videos using youtube-dl, Using youtube-dl embedded with Python. ... In this tutorial, we'll call it from our Python code....
Read more >Download a whole YouTube Playlist at one go
For detailed information, you can go through the Docs. Youtube-dl. "Program to download videos from YouTube.com and other video sites" - Pypi.
Read more >Python script to download youtube videos/playlists/channels
Set the default path to where ever you want to store your videos. · Set the rate limit to your prefered limit (Usefull...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
When downloading, 0 means success. Anything else means an error. (Classic C behavior.)
You were on the right track,
result = ydl.extract_info(url, False)
should give what you want. Default is to download everything, which you don’t want, thus download=False.Arguments are bools not strings.