deepjyoti30 / ytmdl

A simple app to get songs from YouTube in mp3 format with artist name, album name etc from sources like iTunes, Spotify, LastFM, Deezer, Gaana etc.
https://ytmdl.deepjyoti30.dev
MIT License
3.21k stars 164 forks source link

[Feature] Ignore if some song is unavailable from the passed playlist #50

Closed deepjyoti30 closed 4 years ago

deepjyoti30 commented 4 years ago

@EvilSpark Can you please gimme the proper logs where the playlist extraction is failing.

It's hard to recreate the issue and fix it, I haven't faced it yet. It'd be easier for me to add the option you mentioned.

Sparklytical commented 4 years ago

ytmdl https://youtube.com/playlist\?list\=RDCLAK5uy_lnc8KRduWMg4K23TYAOcjTmInGyveebVs Let's take an example of this playlist. After it gives an option to select the video, it starts downloading it-

 ==> Searching to see if already present in /home/evilspark/Music
 ==> Searching Youtube for https://youtube.com/playlist?list=RDCLAK5uy_lnc8KRduWMg4K23TYAOcjTmInGyveebVs
 ==> Choose One
 [1] Bollywood Sensuous Songs by KABHI JO BAADAL BARSE with dur Playlist
 ==> Enter Choice [a valid choice] 1
 ==> Downloading Bollywood Sensuous Songs in 320kbps
 ==> Saving the files to: /home/evilspark/.cache/ytmdl
ERROR: mInGyveebVs: YouTube said: This video is unavailable.
Sorry about that.
 ==> ERROR: mInGyveebVs: YouTube said: This video is unavailable.
Sorry about that.

And if we do - ytmdl Massive Pop Remixes

it gives this error -


ytmdl Massive Pop Remixes
 ==> Searching to see if already present in /home/evilspark/Music
 ==> Searching Youtube for Massive Pop Remixes
 ==> Choose One
 [1] Massive Pop Remixes by Gimme Gimme Gimme with dur Playlist
 [2] Massive Pop Remixes by Joseph Romaniuk with dur Playlist
 [3] Massive Pop Remixes by Cameron Viveiros with dur Playlist
 [4] Massive Pop Remixes by Krista Williams with dur Playlist
 [5] Massive pop remixes by Salote Tela with dur Playlist
 [0] More results
 ==> Enter Choice [a valid choice] 1
 ==> Downloading Massive Pop Remixes in 320kbps
 ==> Saving the files to: /home/evilspark/.cache/ytmdl
ERROR: rNkAivAHGVs: YouTube said: This video is unavailable.
Sorry about that.
 ==> ERROR: rNkAivAHGVs: YouTube said: This video is unavailable.
Sorry about that.

Sort of this is not your CLI error but that of youtube-dl. So in order to mitigate it, you can add --ignore-errors to the youtube-dl string. It will directly skip the stopped downloads and continue further.

@deepjyoti30

deepjyoti30 commented 4 years ago

@EvilSpark Thanks for the explanation.

It's actually not as simple as passing a flag to youtube-dl since I'm not actually downloading the playlist as a whole using youtube-dl, insteas I am passing each song so that youtube-dl can download. It is necessary because after the download, the metadata of the song is also being added . However I think I can handle the error when I'm calling youtube-dl to download, lemme see what I can do.

deepjyoti30 commented 4 years ago

@EvilSpark Made some changes, it should be working now.

Sparklytical commented 4 years ago
 ==> Searching to see if already present in /home/evilspark/Music
 ==> Searching Youtube for Massive Pop Remixes
 ==> Choose One
 [1] Massive Pop Remixes by Gimme Gimme Gimme with dur Playlist
 [2] Massive Pop Remixes by Joseph Romaniuk with dur Playlist
 [3] Massive Pop Remixes by Cameron Viveiros with dur Playlist
 [4] Massive pop remix by Peyton Finch with dur Playlist
 [5] Massive pop remixes by Salote Tela with dur Playlist
 [0] More results
 ==> Enter Choice [a valid choice] 1
 ==> Downloading Massive Pop Remixes in 320kbps
 ==> Saving the files to: /home/evilspark/.cache/ytmdl
ERROR: rNkAivAHGVs: YouTube said: This video is unavailable.
Sorry about that.
 ==> ERROR: rNkAivAHGVs: YouTube said: This video is unavailable.
Sorry about that.
 ==> --ignore-errors passed. Skipping this song!

It is giving this error now.

It stops after it.

deepjyoti30 commented 4 years ago

Yeah, the thing is currently you can search and download playlists, only way to do that for now is passing the youtube playlist URL to ytmdl and each song will be downloaded from that playlist.

Try passing the playlist URL to ytmdl

Sparklytical commented 4 years ago
ytmdl https://www.youtube.com/playlist\?list\=RDCLAK5uy_lFlKms7Zm3D734_wJr1p7ErNkAivAHGVs
 ==> Youtube playlist passed...extracting!
 ==> Playlist: Massive Pop Remixes
 ==> 114 songs found
 ==> Searching to see if already present in /home/evilspark/Music
Traceback (most recent call last):
  File "/usr/local/bin/ytmdl", line 4, in <module>
    __import__('pkg_resources').run_script('ytmdl==2020.3.21', 'ytmdl')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1470, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/local/lib/python3.8/dist-packages/ytmdl-2020.3.21-py3.8.egg/EGG-INFO/scripts/ytmdl", line 372, in <module>
  File "/usr/local/lib/python3.8/dist-packages/ytmdl-2020.3.21-py3.8.egg/EGG-INFO/scripts/ytmdl", line 365, in extract_data
  File "/usr/local/lib/python3.8/dist-packages/ytmdl-2020.3.21-py3.8.egg/EGG-INFO/scripts/ytmdl", line 259, in main
TypeError: string indices must be integers
deepjyoti30 commented 4 years ago

@EvilSpark I've made the changes, check the latest commit.

Sparklytical commented 4 years ago

Another Error -

If it's unable to find data, it stops the searching.

ytmdl https://www.youtube.com/playlist\?list\=PLoyrCoTq1l0W1q0QooB2LLTPLi_iT7OuX
 ==> Youtube playlist passed...extracting!
 ==> Playlist: Massive Pop Remixes
 ==> 45 songs found
 ==> Searching to see if already present in /home/evilspark/Music
 ==> Downloading Maggie Lindemann - Pretty Girl (Cheat Codes x Cade Remix) in 320kbps
 ==> Saving the files to: /home/evilspark/.cache/ytmdl
3 MB   | 912 Kb/s || ETA: 1 s                                                                               |▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓| 100% ==> Downloaded!
 ==> Converting to mp3...
 ==> Getting song data for maggie lindemann pretty girl cheat codes x cade remix...
 ==> No data was found!
deepjyoti30 commented 4 years ago

This one is probably because the title is filled with lots of unnecessary info and that's stopping the itunes and gaana searches from being able to return a result.

This is a known problem and I'm yet to find a fix for it. I did added some measures to remove words like official video etc but it still needs some work.