Skip to content

Instantly share code, notes, and snippets.

@ivanskodje
Last active October 27, 2025 16:45
Show Gist options
  • Save ivanskodje/5e6f4f7d883cd1124d6d0680b51c4cd9 to your computer and use it in GitHub Desktop.
Save ivanskodje/5e6f4f7d883cd1124d6d0680b51c4cd9 to your computer and use it in GitHub Desktop.

Revisions

  1. ivanskodje revised this gist Sep 30, 2018. 1 changed file with 9 additions and 5 deletions.
    14 changes: 9 additions & 5 deletions youtube-dl-download-youtube-music-playlists.md
    Original file line number Diff line number Diff line change
    @@ -18,10 +18,14 @@ You can get it [here](https://ffmpeg.org/download.html#build-windows) from FFMPE
    ### 3. Unzip the ffmpeg file
    Rename the unzipped folder to "ffmpeg" and place it somewhere familiar (Recommending C:/ffmpeg/).

    ### 4. Add the C:/ffmpeg/bin/ folder to PATH
    Open Powershell, enter `$env:Path += ";C:\ffmpeg\bin\"` (change path accordingly. Note the slashes.) and press enter.
    Close Powershell.
    The contents of the C:/ffmpeg/bin folder will be accessible directly without having to specify the path.
    ### 4. Add the C:/ffmpeg/bin/ and C:/youtube-dl/ folder to PATH
    Search for `Environment` and choose `Edit the system environment variables` option.
    Press the `Environment Variables...` button.
    Double-click the Path variable, in the top section.
    Select `New` and add `C:/ffmpeg/bin/`.
    Do the same for `C:/youtube-dl/`.

    The contents of the folders will now be accessible directly without having to specify the path, the next time you open powershell/cmd.

    ### 5. Create a bat script file
    We need to create bat script that will store all the information we need to quickly and easily download music from YouTube.
    @@ -32,7 +36,7 @@ Create a new file and name it 'youtube-mp3.bat'. Put it in the same folder as yo
    > .\youtube-dl.exe ^
    > --extract-audio ^
    > --audio-format mp3 ^
    > --output "C:/Users/YOUR-USERNAME-HERE/Music/YouTube/%%(playlist_title)s/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > --output "Music/YouTube/%%(playlist_title)s/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > %%a
    > )
  2. ivanskodje revised this gist Sep 30, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion youtube-dl-download-youtube-music-playlists.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ You can get it [here](https://ffmpeg.org/download.html#build-windows) from FFMPE
    Rename the unzipped folder to "ffmpeg" and place it somewhere familiar (Recommending C:/ffmpeg/).

    ### 4. Add the C:/ffmpeg/bin/ folder to PATH
    Open Powershell, enter `set PATH=%PATH%;C:\ffmpeg\bin\` (change path accordingly. Note the slashes.) and press enter.
    Open Powershell, enter `$env:Path += ";C:\ffmpeg\bin\"` (change path accordingly. Note the slashes.) and press enter.
    Close Powershell.
    The contents of the C:/ffmpeg/bin folder will be accessible directly without having to specify the path.

  3. ivanskodje revised this gist Jul 8, 2018. 1 changed file with 57 additions and 2 deletions.
    59 changes: 57 additions & 2 deletions youtube-dl-download-youtube-music-playlists.md
    Original file line number Diff line number Diff line change
    @@ -58,7 +58,7 @@ You can also add multiple URLs and playlists, separated only by a space:
    For example:
    > .\youtube-mp3.bat https://www.youtube.com/playlist?list=PLYPeGyDTfTSuyzSADAeZiuR28F1PkXERE https://www.youtube.com/watch?v=qRC4Vk6kisY https://www.youtube.com/playlist?list=PLthjj8uzMeTVDDlXYmxOqN5Uvfj2OXpmg
    If you open up a text editor (for copy/paste), you can prepare all your URL in a similar fashion:
    If you open up a text editor, you can prepare all your URL in a similar fashion:
    > .\youtube-mp3.bat ^
    > [URL1] ^
    > [URL2] ^
    @@ -67,4 +67,59 @@ If you open up a text editor (for copy/paste), you can prepare all your URL in a
    -----------

    # youtube-dl for Linux
    *Coming soon...?*

    ### 1. Download youtube-dl
    You can get it [here](https://rg3.github.io/youtube-dl/) from their official web-site.
    Place it somewhere familiar (Recommending /usr/local/bin/youtube-dl)

    ### 2. Install ffmpeg
    On Ubuntu/Linux Mint based systems, open the terminal and run: `sudo apt-get install ffmpeg -y`

    ### 3. Create a bash script
    We need to create a bash script that will store all the information we need to quickly and easily download music from YouTube.

    `sudo touch /usr/local/bin/youtube-mp3`
    Adding it in /usr/local/bin will allow you to access it without having to specify a path.

    ### 4. Edit the file
    In this example we will be using nano. Feel free to use whatever editor you want, however.

    `sudo nano youtube-mp3`
    If nano does not work for you, you can install it by running: `sudo apt-get install nano -y`.

    ### 5. Paste in the script
    > #!/bin/bash
    > for i in "$@";
    > do
    > youtube-dl --extract-audio \
    > --audio-format mp3 \
    > --output "~/Music/%(playlist_title)s/%(playlist_index)s - %(title)s.%(ext)s" \
    > "$i"
    > done
    1. Feel free to change the path however you wish. ~/ will be within your users home directory.
    2. If you wish to change the formatting of the output files, you can learn more about it [here](https://github.com/rg3/youtube-dl/blob/master/README.md#readme).
    3. If you have any issues, feel free to comment about it.

    ### 6. Download music from YouTube!
    In order to start downloading music, simply run in the terminal: `youtube-mp3 <link to youtube-video or playlist>`.

    To download youtube music, run:
    > youtube-mp3 [URL-TO-YOUTUBE-PLAYLIST]
    1. Keep in mind that it must be an URL to the playlist itself, and *NOT a video in a playlist*!

    For example:
    > youtube-mp3 https://www.youtube.com/playlist?list=PLYPeGyDTfTSuyzSADAeZiuR28F1PkXERE

    You can also add multiple URLs and playlists, separated only by a space:
    > youtube-mp3 [URL1] [URL2] [URL3]
    For example:
    > youtube-mp3 https://www.youtube.com/playlist?list=PLYPeGyDTfTSuyzSADAeZiuR28F1PkXERE https://www.youtube.com/watch?v=qRC4Vk6kisY https://www.youtube.com/playlist?list=PLthjj8uzMeTVDDlXYmxOqN5Uvfj2OXpmg
    If you open up a text editor, you can prepare all your URL in a similar fashion:
    > youtube-mp3 /
    > [URL1] /
    > [URL2] /
    > [URL3]
  4. ivanskodje revised this gist Jul 1, 2018. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions youtube-dl-download-youtube-music-playlists.md
    Original file line number Diff line number Diff line change
    @@ -28,12 +28,12 @@ We need to create bat script that will store all the information we need to quic
    Create a new file and name it 'youtube-mp3.bat'. Put it in the same folder as youtube-dl.exe (from step 1).

    ### 6. Paste in the script
    > for %%a in (%*) do (
    > .\youtube-dl.exe ^
    > --extract-audio ^
    > --audio-format mp3 ^
    > --output "C:/Users/YOUR-USERNAME-HERE/Music/YouTube/%%(playlist_title)s/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > %%a
    > for %%a in (%*) do (
    > .\youtube-dl.exe ^
    > --extract-audio ^
    > --audio-format mp3 ^
    > --output "C:/Users/YOUR-USERNAME-HERE/Music/YouTube/%%(playlist_title)s/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > %%a
    > )
    1. Remember to add your own windows username in *YOUR-USERNAME-HERE*.
  5. ivanskodje revised this gist Jul 1, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion youtube-dl-download-youtube-music-playlists.md
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ Create a new file and name it 'youtube-mp3.bat'. Put it in the same folder as yo
    > --audio-format mp3 ^
    > --output "C:/Users/YOUR-USERNAME-HERE/Music/YouTube/%%(playlist_title)s/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > %%a
    > )
    > )
    1. Remember to add your own windows username in *YOUR-USERNAME-HERE*.
    2. If you wish to change the formatting of the output files, you can learn more about it [here](https://github.com/rg3/youtube-dl/blob/master/README.md#readme).
  6. ivanskodje revised this gist Jul 1, 2018. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions youtube-dl-download-youtube-music-playlists.md
    Original file line number Diff line number Diff line change
    @@ -28,13 +28,13 @@ We need to create bat script that will store all the information we need to quic
    Create a new file and name it 'youtube-mp3.bat'. Put it in the same folder as youtube-dl.exe (from step 1).

    ### 6. Paste in the script
    > for %%a in (%*) do (
    > .\youtube-dl.exe ^
    > --extract-audio ^
    > --audio-format mp3 ^
    > --output "C:/Users/YOUR-USERNAME-HERE/Music/YouTube/%%(playlist_title)s/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > %%a
    > )
    > for %%a in (%*) do (
    > .\youtube-dl.exe ^
    > --extract-audio ^
    > --audio-format mp3 ^
    > --output "C:/Users/YOUR-USERNAME-HERE/Music/YouTube/%%(playlist_title)s/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > %%a
    > )
    1. Remember to add your own windows username in *YOUR-USERNAME-HERE*.
    2. If you wish to change the formatting of the output files, you can learn more about it [here](https://github.com/rg3/youtube-dl/blob/master/README.md#readme).
  7. ivanskodje revised this gist Jul 1, 2018. No changes.
  8. ivanskodje revised this gist Jul 1, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion youtube-dl-download-youtube-music-playlists.md
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,7 @@ Create a new file and name it 'youtube-mp3.bat'. Put it in the same folder as yo
    > .\youtube-dl.exe ^
    > --extract-audio ^
    > --audio-format mp3 ^
    > --output "C:/Users/YOUR-USERNAME-HERE/Music/YouTube/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > --output "C:/Users/YOUR-USERNAME-HERE/Music/YouTube/%%(playlist_title)s/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > %%a
    > )
  9. ivanskodje created this gist Jul 1, 2018.
    70 changes: 70 additions & 0 deletions youtube-dl-download-youtube-music-playlists.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,70 @@
    Downloading Music Playlists from YouTube
    ============

    ### Disclaimer
    *Use this knowledge at your own risk.*

    # youtube-dl for Windows
    **youtube-dl** will allow you to *download entire youtube playlists* and store them as MP3s.
    This will also allow you to download individual MP3s.

    ### 1. Download the youtube-dl.exe
    You can get it [here](https://rg3.github.io/youtube-dl/) from their official web-site.
    Place it somewhere familiar (Recommending C:/youtube-dl/youtube-dl.exe)

    ### 2. Download and install ffmpeg
    You can get it [here](https://ffmpeg.org/download.html#build-windows) from FFMPEGs web-site.

    ### 3. Unzip the ffmpeg file
    Rename the unzipped folder to "ffmpeg" and place it somewhere familiar (Recommending C:/ffmpeg/).

    ### 4. Add the C:/ffmpeg/bin/ folder to PATH
    Open Powershell, enter `set PATH=%PATH%;C:\ffmpeg\bin\` (change path accordingly. Note the slashes.) and press enter.
    Close Powershell.
    The contents of the C:/ffmpeg/bin folder will be accessible directly without having to specify the path.

    ### 5. Create a bat script file
    We need to create bat script that will store all the information we need to quickly and easily download music from YouTube.
    Create a new file and name it 'youtube-mp3.bat'. Put it in the same folder as youtube-dl.exe (from step 1).

    ### 6. Paste in the script
    > for %%a in (%*) do (
    > .\youtube-dl.exe ^
    > --extract-audio ^
    > --audio-format mp3 ^
    > --output "C:/Users/YOUR-USERNAME-HERE/Music/YouTube/%%(playlist_index)s - %%(title)s.%%(ext)s" ^
    > %%a
    > )
    1. Remember to add your own windows username in *YOUR-USERNAME-HERE*.
    2. If you wish to change the formatting of the output files, you can learn more about it [here](https://github.com/rg3/youtube-dl/blob/master/README.md#readme).
    3. If it cannot find ffmpeg, then you most likely did not correctly add C:\ffmpeg\bin\ to PATH environment. [Search for a solution](https://duckduckgo.com/?q=how+to+add+PATH+variable+on+windows&atb=v59-6_e&ia=qa).

    ### 7. Download music from YouTube!
    In order to start downloading music, you need to open up a command prompt or Windows PowerShell.
    In Explorer, navigate to the folder with the youtube-mp3.bat script. Hold left-shift and right mouse click in the folder (Not directly on an item). Select 'Open PowerShell Window here', or the 'Command Prompt' equivalent.

    To download youtube music, run:
    > .\youtube-mp3.bat [URL-TO-YOUTUBE-PLAYLIST]
    1. Keep in mind that it must be an URL to the playlist itself, and *NOT a video in a playlist*!

    For example:
    > .\youtube-mp3.bat https://www.youtube.com/playlist?list=PLYPeGyDTfTSuyzSADAeZiuR28F1PkXERE

    You can also add multiple URLs and playlists, separated only by a space:
    > .\youtube-mp3.bat [URL1] [URL2] [URL3]
    For example:
    > .\youtube-mp3.bat https://www.youtube.com/playlist?list=PLYPeGyDTfTSuyzSADAeZiuR28F1PkXERE https://www.youtube.com/watch?v=qRC4Vk6kisY https://www.youtube.com/playlist?list=PLthjj8uzMeTVDDlXYmxOqN5Uvfj2OXpmg
    If you open up a text editor (for copy/paste), you can prepare all your URL in a similar fashion:
    > .\youtube-mp3.bat ^
    > [URL1] ^
    > [URL2] ^
    > [URL3]
    -----------

    # youtube-dl for Linux
    *Coming soon...?*