5

Ubuntu 18.04. What I would like to do using youtube-dl is get a list of the video names and the date they were uploaded (the extension doesn't matter) without downloading the videos. Is there a command to do this?

1 Answers1

5

Open the terminal and type:

sudo apt install jq # command-line JSON processor  
cd Desktop/  
youtube-dl -j --flat-playlist "https://<yourYoutubePlaylist>" | jq -r '.id' | sed 's_^_https://youtu.be/_' > result.txt

Example command:

youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=iwhuPxJ0dig&list=PLei96ZX_m9sU3dLM2I5LKcqXeqth-GTe6" | jq -r '.id' | sed 's_^_https://youtu.be/_' > result.txt  

The results of example command in result.txt are shown below. Unfortunately the -j (--dump-json) option does not return data about the dates that the videos were uploaded, but it can return the titles of the videos. Another nice feature is that the videos don't need to all be in the same playlist. The same command can also return the URLs of all the videos on the same channel or user webpage.

https://youtu.be/iwhuPxJ0dig  
https://youtu.be/ArDT5NsROMk 

Explanation:

-j, --dump-json  
       Simulate, quiet but print JSON information. See the "OUTPUT  
       TEMPLATE" for a description of available keys.

--flat-playlist
       Do not extract the videos of a playlist, only list them.

jq is like sed for JSON data – you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.

karel
  • 114,770