Skip to content

Instantly share code, notes, and snippets.

@vic
Last active February 2, 2018 20:54
Show Gist options
  • Save vic/dd02d2d28e9ff484ee74a833c0a9dff7 to your computer and use it in GitHub Desktop.
Save vic/dd02d2d28e9ff484ee74a833c0a9dff7 to your computer and use it in GitHub Desktop.
Save a YouTube list as a playlist of videos.
#!/usr/bin/env bash
#
# ytpls.sh - Save a YouTube list as a playlist of videos.
#
#
# Doesnt actually download the videos, it just creates a playlist file `.pls` containing each video url.
# You can open such files with VLC or other media player on desktop and mobile.
#
#
# USAGE
#
# ytpl.sh "https://www.youtube.com/watch?v=z368xM1SXpU&index=1&list=PL5tMriwQYETbHMNUvUG2w04M0Es3WvinF" > file.pls
#
nl='
'
echo "[playlist]"
youtube-dl --get-filename -o "Title%(playlist_index)s=%(title)s${nl}File%(playlist_index)s=https://youtu.be/%(id)s" --yes-playlist $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment