Git Product home page Git Product logo

yt-playlist's Introduction

yt-playlist

A YouTube playlist downloader. Requires Python 3.11+, pytube, and ffmpeg to work.

This script will download the audio of every song in a YouTube playlist, then convert the audio to mp3. To use, place it in the folder in which you want to download the playlist.

I am not actively monitoring this but I'll merge any updates that anyone else wants to make.

Packages and versions

  • pytube==12.1.0

Installation

  1. git clone https://github.com/modkhi/yt-playlist.git or download the source code
  2. navigate to the folder
  3. do pip install -r requirements.txt to install the package from requirements.txt
  4. do py yt-playlist-download.py
  5. enjoy!

Usage

  • Please enter the url of the playlist you wish to download: - playlist from youtube only
    • e.g. https://www.youtube.com/playlist?list=OLAK5uy_lbX9HmX4ZrMSrS5wpDonp-EFy4IrhQeCc
  • Downloads destination (optional): - must insert the full path
    • e.g. C:\Users\Username\Folder

yt-playlist's People

Contributors

modkhi avatar onyxcode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yt-playlist's Issues

'Playlist' object has no attribute 'parse_links'

Traceback (most recent call last):
  File "C:\Users\Windows\Desktop\yt-playlist-master\yt-playlist-download.py", line 38, in <module>
    run(pl)
  File "C:\Users\Windows\Desktop\yt-playlist-master\yt-playlist-download.py", line 12, in run
    links = pl.parse_links()
AttributeError: 'Playlist' object has no attribute 'parse_links'

erring out

Using python3.7
pytube3
ffmpeg binary (ffmpeg-98315-g60d79b1df9)

It downloads and converts first file. But errors out after that.

`$ python3 youtube_playlist_mp3_download.py
Please enter the url of the playlist you wish to download: https://www.youtube.com/playlist?list=PLIO7o3VwD0X_hglBI3zHjZQW6GOJT30Vy
Please enter the filepath of the directory where this script is located:
/Users/nikunj.badjatya/Music/caravaan/
youtube_playlist_mp3_download.py:12: DeprecationWarning: Call to deprecated function parse_links (This function will be removed in the future, please use .video_urls).
links = pl.parse_links()
Downloading Chhod Gaye Balam Mujhe - Barsaat - Lata Mangeshkar Mukesh.mp4...
Converting to mp3....
ffmpeg version N-98315-g60d79b1df9-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 56. 55.100 / 56. 55.100
libavcodec 58. 93.100 / 58. 93.100
libavformat 58. 47.100 / 58. 47.100
libavdevice 58. 11.100 / 58. 11.100
libavfilter 7. 86.100 / 7. 86.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/nikunj.badjatya/Music/caravaan/Chhod Gaye Balam Mujhe - Barsaat - Lata Mangeshkar Mukesh.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2019-11-06T16:55:15.000000Z
Duration: 00:04:32.02, start: 0.000000, bitrate: 326 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 480x360 [SAR 1:1 DAR 4:3], 227 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 2019-11-06T16:55:15.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 11/06/2019.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)
Metadata:
creation_time : 2019-11-06T16:55:15.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 11/06/2019.
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to '/Users/nikunj.badjatya/Music/caravaan/Chhod Gaye Balam Mujhe - Barsaat - Lata Mangeshkar Mukesh.mp3':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
TSSE : Lavf58.47.100
Stream #0:0(und): Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp (default)
Metadata:
creation_time : 2019-11-06T16:55:15.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 11/06/2019.
encoder : Lavc58.93.100 libmp3lame
size= 4251kB time=00:04:32.04 bitrate= 128.0kbits/s speed=27.9x
video:0kB audio:4251kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.007948%
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pytube/extract.py", line 297, in apply_descrambler
for format_item in formats
File "/usr/local/lib/python3.7/site-packages/pytube/extract.py", line 297, in
for format_item in formats
KeyError: 'url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "youtube_playlist_mp3_download.py", line 38, in
run(pl)
File "youtube_playlist_mp3_download.py", line 16, in run
yt = YouTube(l)
File "/usr/local/lib/python3.7/site-packages/pytube/main.py", line 92, in init
self.descramble()
File "/usr/local/lib/python3.7/site-packages/pytube/main.py", line 132, in descramble
apply_descrambler(self.player_config_args, fmt)
File "/usr/local/lib/python3.7/site-packages/pytube/extract.py", line 301, in apply_descrambler
parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
File "/usr/local/lib/python3.7/site-packages/pytube/extract.py", line 301, in
parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
KeyError: 'cipher'`

probably a simple issue but idk, i have basically 0 experience with python

the playlist in question is 100% valid and the file path im sending it to is as well

限界突破×サバイバー.mp4
Downloading 限界突破×サバイバー.mp4...
Converting to mp3....
Traceback (most recent call last):
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 825, in move
os.rename(src, real_dst)
FileNotFoundError: [WinError 2] The system cannot find the file specified: '限界突破×サバイバー.mp3' -> 'C:\Users\hamax\Desktop\Music\Downloads\限界突破×サバイバー.mp3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\hamax\Desktop\Music\save_playlist.py", line 49, in run
shutil.move(new_filename_remove_spaces, os.path.join(os.path.abspath("./Downloads"), new_filename_remove_spaces))
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 845, in move
copy_function(src, real_dst)
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 436, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 256, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '限界突破×サバイバー.mp3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 825, in move
os.rename(src, real_dst)
FileNotFoundError: [WinError 2] The system cannot find the file specified: '限界突破×サバイバー.mp3' -> 'C:\Users\hamax\Desktop\Music\Downloads\限界突破×サバイバー.mp3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\hamax\Desktop\Music\save_playlist.py", line 73, in
run(pl)
File "C:\Users\hamax\Desktop\Music\save_playlist.py", line 54, in run
shutil.move(new_filename_remove_spaces, os.path.join(os.path.abspath("./Downloads"), new_filename_remove_spaces))
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 845, in move
copy_function(src, real_dst)
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 436, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 256, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '限界突破×サバイバー.mp3'

now im no python expert but i think my issue derives directly from the fact it does not use English characters, im going to work to resolve this myself but keep this in mind if you ever come and update it again.

can't run

Traceback (most recent call last):
File "C:/Users/username/PycharmProjects/ytd/main.py", line 39, in
run(pl)
File "C:/Users/username/PycharmProjects/ytd/main.py", line 16, in run
yt = YouTube(l)
File "C:\Users\username\PycharmProjects\ytd\venv\lib\site-packages\pytube_main_.py", line 88, in init
self.prefetch_init()
File "C:\Users\username\PycharmProjects\ytd\venv\lib\site-packages\pytube_main_.py", line 97, in prefetch_init
self.init()
File "C:\Users\username\PycharmProjects\ytd\venv\lib\site-packages\pytube_main_.py", line 143, in init
mixins.apply_descrambler(self.player_config_args, fmt)
File "C:\Users\username\PycharmProjects\ytd\venv\lib\site-packages\pytube\mixins.py", line 96, in apply_descrambler
for i in stream_data[key].split(',')
KeyError: 'url_encoded_fmt_stream_map'

Not working properly

The script is downloading mp3 and mp4 from the same video and it is not downloading all the videos in the playlist

Improvements made

Hi!

I made significant improvements to your project. Let me push/open PR!

Please make requirements.txt

I'm working on a google colab of this, but I don't know what libraries to use because I used the ones metioned in the first few lines and it only found 1 library (pytube).

Closed the previous issue because that is completely different and the issue is now smaller since i changed a couple things

this is the issue i get now

Traceback (most recent call last):
File "C:\Users\hamax\Desktop\Music\yt-playlist-download.py", line 73, in
run(pl)
File "C:\Users\hamax\Desktop\Music\yt-playlist-download.py", line 21, in run
music = yt.streams.filter(file_extension="mp4").first()
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytube_main_.py", line 296, in streams
return StreamQuery(self.fmt_streams)
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytube_main_.py", line 176, in fmt_streams
stream_manifest = extract.apply_descrambler(self.streaming_data)
File "C:\Users\hamax\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytube_main_.py", line 161, in streaming_data
return self.vid_info['streamingData']
KeyError: 'streamingData'

i am entering a valid path for the music to be sent to, and my playlist should be valid

Stupid Question

Hey!! Great script, really useful I was wondering if I can fork this repository for the purpose of adding a UI and a few new features do you mind??

PS: I'm opening an issue because I don't think Github has a way to directly send a message and I don't know how to contact you otherwise.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.