Coder Social home page Coder Social logo

deepjyoti30 / ytmdl Goto Github PK

View Code? Open in Web Editor NEW
3.0K 38.0 157.0 15.48 MB

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.

Home Page: https://ytmdl.deepjyoti30.dev

License: MIT License

Python 100.00%
songs youtube metadata itunes mp3 id3 gaana youtube-dl ffmpeg cli

ytmdl's Introduction

YouTube Music Downloader

Download songs from YouTube by getting the audio from YouTube and the metadata from sources like Itunes, Spotify, Gaana etc.


Web App

Ytmdl also has an web app, you can try it out here

Why this?

This app downloads a song by getting the audio from Youtube sources using youtube-dl and then adds song information like artist name, album name, release date, thumbnail etc by fetching it from sources like Itunes, Spotify, Gaana and other sources.

NO. YoutubeDL doesn't do that. All youtube-dl does is lets you download audio from a video that you specify. This app is not yet another youtube-dl clone.

Support the Project?

Help the development of this project by becoming a backer or a sponsor.

If you like my work, consider buying me a coffee or donating. In case you want to become a patron, join my Pateron

undefined undefined undefined

Requirements

  • Python 3.6.1
  • ffmpeg

Installation

PyPI

pip install ytmdl

NOTE: System wide installation requires sudo

Arch Linux

ytmdl is available in AUR as ytmdl. It can be found here

NOTE: The git version is availble as ytmdl-git in AUR.

Gentoo

ytmdl can be installed in Gentoo by the following commands

# First set up src_prepare-overlay (as root)
emerge -av --noreplace app-eselect/eselect-repository
eselect repository enable src_prepare-overlay
emaint sync -r src_prepare-overlay
# Finally emerge ytmdl (as root)
emerge -av --autounmask net-misc/ytmdl

Available in src_prepare-overlay here

NixOS

ytmdl can be installed using Nix with the command

nix-env -iA nixos.ytmdl

Windows

You need to install ffmpeg in order for ytmdl to work properly. This can be done by downloading the ffmpeg binary from here. Once downloaded, extract the file and find the ffmpeg.exe file. Copy the directory's path and add it to PATH in the following way.

setx path "%path%;C:\your\path\here\"

Once ffmpeg is installed, install ytmdl using the following command

pip install ytmdl --upgrade

NOTE: You'll need to have Python 3.6.1 or more installed.

Optionally, also install the latest version of downloader-cli and simber using the following command:

pip install simber downloader-cli --upgrade

Manual

You can manually install ytmdl by cloning this repository and running the setup.py script.

  1. Install setuptools if it isn't already:

     pip install setuptools
  2. Clone this repo:

    git clone https://github.com/deepjyoti30/ytmdl
  3. Move into the ytmdl directory and run the setup.py script:

    cd ytmdl
    sudo python setup.py install

Usage

usage: ytmdl [-h] [-q] [-o OUTPUT_DIR] [--song SONG-METADATA]
             [--choice CHOICE] [--artist ARTIST] [--album ALBUM]
             [--disable-metaadd] [--skip-meta] [-m] [--itunes-id ITUNES_ID]
             [--spotify-id SPOTIFY_ID] [--disable-sort] [--ask-meta-name]
             [--on-meta-error ON_META_ERROR] [--proxy URL] [--url URL]
             [--list PATH TO LIST] [--nolocal] [--format FORMAT] [--trim]
             [--version] [--keep-chapter-name] [--download-archive FILE]
             [--ignore-chapters] [--ytdl-config PATH] [--dont-transcode]
             [--filename NAME] [--pl-start NUMBER] [--pl-end NUMBER]
             [--pl-items ITEM_SPEC] [--ignore-errors] [--title-as-name]
             [--level LEVEL] [--disable-file] [--list-level]
             [SONG_NAME ...]

positional arguments:
  SONG_NAME             Name of the song to download. Can be an URL to a
                        playlist as well. It will be automatically recognized.

optional arguments:
  -h, --help            show this help message and exit
  -q, --quiet           Don't ask the user to select songs if more than one
                        search result. The first result in each case will be
                        considered.
  -o OUTPUT_DIR, --output-dir OUTPUT_DIR
                        The location for the song to be downloaded to. When no
                        argument is passed, the default locations of SONG_DIR
                        or XDG_MUSIC_DIR are used.
  --proxy URL           Use the specified HTTP/HTTPS/SOCKS proxy. To enable
                        SOCKS proxy, specify a proper scheme. For example
                        socks5://127.0.0.1:1080/. Pass in an empty string
                        (--proxy "") for direct connection
  --url URL             Youtube song link.
  --list PATH TO LIST   Download list of songs. The list should have one song
                        name in every line.
  --nolocal             Don't search locally for the song before downloading.
  --format FORMAT       The format in which the song should be downloaded.
                        Default is mp3, but can be set in config. Available
                        options are ['mp3', 'm4a', 'opus']
  --trim, -t            Trim out the audio from the song. Use underlying
                        speech and music segmentation engine to determine and
                        keep only the music in the file. Useful in songs where
                        there are speeches, noise etc before/after the start
                        of the song. Default is false.
  --version             show the program version number and exit
  --keep-chapter-name   Keep the title extracted from the chapter in order to
                        search for the metadata. If not passed, the user will
                        be asked if they'd like to change the title with which
                        the metadata will be searched.
  --download-archive FILE
                        Skip downloading songs that are present in the passed
                        file. The songs are matched by using the videoId. All
                        downloaded song Id's are automatically added to the
                        file.
  --ignore-chapters     Ignore chapters if available in the video and treat it
                        like one video
  --ytdl-config PATH    Path to the youtube-dl config location or the
                        directory
  --dont-transcode      Don't transcode the audio after downloading.
                        Applicable for OPUS format only. (Default: false)
  --filename NAME       Final filename after the song is ready to be used.
                        This will be given priority over automatic detection
                        unless dynamic filename path is set through config

Metadata:
  --song SONG-METADATA  The song to search in Metadata. Particularly useful
                        for songs that have the names in a different language
                        in YouTube. For Example, greek songs.
  --choice CHOICE       The choice that the user wants to go for. Usefull to
                        pass along with --quiet. Choices start at 1
  --artist ARTIST       The name of the song's artist. Pass it with a song
                        name.
  --album ALBUM         The name of the song's album. Pass it with a song
                        name.
  --disable-metaadd     Disable addition of passed artist and album keyword to
                        the youtube search in order to get a more accurate
                        result. (Default: false)
  --skip-meta           Skip setting the metadata and just copy the converted
                        song to the destination directory. '--manual-meta'
                        will override this option, pass only one of them.
  -m, --manual-meta     Manually enter song details.
  --itunes-id ITUNES_ID
                        Direct lookup from itunes. If passed, metadata will be
                        automatically added.
  --spotify-id SPOTIFY_ID
                        Direct lookup for Spotify tracks using the ID. If
                        passed, metadata will be automatically added.
  --disable-sort        Disable sorting of the metadata before asking for
                        input. Useful if the song is in some other language
                        and/or just a few providers are used.
  --ask-meta-name       Ask the user to enter a separate name for searching
                        the metadata (Default: false)
  --on-meta-error ON_META_ERROR
                        What to do if adding the metadata fails for some
                        reason like lack of metadata or perhaps a network
                        issue. Options are ['exit', 'skip', 'manual',
                        'youtube']

Playlist:
  --pl-start NUMBER     Playlist video to start at (default is 1)
  --pl-end NUMBER       Playlist video to end at (default is last)
  --pl-items ITEM_SPEC  Playlist video items to download. Specify indices of
                        the videos present in the playlist separated by commas
                        like: '--playlist-items 1, 2, 4, 6' if you want to
                        download videos indexed 1, 2, 4 and 6. Range can also
                        be passed like: '--playlist-items 1-3, 5-7' to
                        download the videos indexed at 1, 2, 3, 5, 6, 7.
  --ignore-errors       Ignore if downloading any video fails in a playlist.
                        If passed, the execution will move to the next video
                        in the passed playlist.
  --title-as-name       Use the title of the video as the name of the song to
                        search for metadata. If not passed, user will be asked
                        if they want to use a different name and continue
                        accordingly.

Logger:
  --level LEVEL         The level of the logger that will be used while
                        verbosing. Use `--list-level` to check available
                        options.
  --disable-file        Disable logging to files
  --list-level          List all the available logger levels.

Configuration

Setup

The defaults can be changed by editing the config file in ytmdl folder in your .config folder

The config will be created automatically the first time you run ytmdl and will be present in ~/.config/ytmdl/config

However, it can be created manually by the following command

mkdir -p ~/.config/ytmdl; curl https://raw.githubusercontent.com/deepjyoti30/ytmdl/master/examples/config > ~/.config/ytmdl/config

Above command will download the config from the repo and save it in the ~/.config/ytmdl/ directory.

Supported Options

As of the latest development branch, the following options can be changed from the config

Name Description Default
SONG_DIR Directory to save the songs in after editing Current directory
SONG_QUALITY Quality of the song 320kbps
METADATA_PROVIDERS Which API providers to use for metadata all supported options are used
DEFAULT_FORMAT Default format of the song mp3
ON_META_ERROR What to do if error occurs while writing meta exit
ITUNES_COUNTRY Which region to use while searching from Itunes US
SPOTIFY_COUNTRY Which market to use while searching from Spotify US

Advanced Configuration

Dynamically storing songs

SONG_DIR field also takes values that are extracted from the song being downloaded

The SONG_DIR field needs to be passed some special values in order to achieve that. The string is scanned and when a $ sign occurs, the special string will start and each directory can be separated by using an -> sign.

To save the song in the /dir/<album_name>/<artist_name>/<title>/<song_name>.mp3 format, the following needs to be added in the SONG_DIR field.

SONG_DIR="/dir$Album->Artist->Title"

Above will extract to the following directory structure when a song named Cradles by artist Sub Urban from the album Cradles - Single

|--dir
   |--Cradles - Single
      |--Sub Urban
         |--Cradles
            |--Cradles.mp3

In order to pass the name with which the song should be saved, the last attribute can be passed between [].

If the SONG_DIR field is /dir$Album->[Artist] will extract to the following directory structure

|--dir
   |--Cradles - Single
      |--Sub Urban.mp3

Supported options for dynamic storing

As of the latest source, the following options can be passed to the special string in order to create dynamic directories

Name
Artist Artist Of the Song
Album Album Of the Song
Title Title Of the Song
Genre Genre Of the Song
TrackNumber TrackNumber Of the Song
ReleaseDate ReleaseDate Of the Song

ytmdl's People

Contributors

0xflotus avatar alx99 avatar biswaroop1547 avatar bmqn avatar danimateo avatar deepjyoti30 avatar dopsi avatar j0hax avatar johnnymatthews avatar jrejaud avatar kochirasu avatar njkevlani avatar onsive avatar philodavies avatar thecatster avatar volt4ire avatar xgqt avatar yantonov avatar yashsinghcodes 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

ytmdl's Issues

WSL - Invalid cross-device link

Hello,

I'm using Ubuntu terminal on Windows with WSL, and I am getting the following error when downloading a song :

==> ERROR: [Errno 18] Invalid cross-device link: '/home/bastien/.cache/ytmdl/Bohemian Rhapsody.mp3' -> 'Bohemian Rhapsody.mp3'

I guess it is because of WSL and Windows.

I didn't any log file so here is what I get by enabling the DEBUG log level :

ytmdl debug log.txt

Hope it helps you improve ytmdl.

Script fails when video has '/' in its name

Bug description

It appears that the download fails when converting a video that has the character / in its name.

Solution proposals

Possible solutions include replacing the / with another symbol (such as \ ) or to just removing it from the filename.

Link used to reproduce the bug:

https://www.youtube.com/watch?v=hIRiwsk5o0o

Terminal output:

➜ ytmdl --url https://www.youtube.com/watch\?v\=hIRiwsk5o0o TEST
 ==> Downloading KANARITE - KARA KOLYO / Канарите - Кара Кольо, 2005 in 320kbps
ERROR: [Errno 2] No such file or directory: '/home/yalishanda/Music/ytmdl/KANARITE#-#KARA#KOLYO#/#Канарите#-#Кара#Кольо,#2005.mp3'
 ==> Downloaded!
 ==> Converting to mp3...
 ==> ERROR: [Errno 2] No such file or directory: '/home/yalishanda/Music/ytmdl/KANARITE#-#KARA#KOLYO#/#Канарите#-#Кара#Кольо,#2005.mp3'

Renaming / Moving fails

Many times the renamed file remains in ~/.cache and you get a weird, unplayable with no metadata and youtube-dl's naming .mp3 file in ~/Music instead. Can't find what causes this but it happens really often.

Fails when ~/Music does not exist.

The script currently errors with a FileNotFoundError when the Music directory does not exist in the home directory.

To reproduce on default configuration:

  1. (re)move the Music directory from your home directory (if exists)
  2. run ytmdl any song
  3. observe the error

I think it would probably be best to not assume the existance of any folders in the home directory and by default just download to the current working directory, unless specified otherwise in user-specific configuration.

config file

I'm having trouble when changing the config file. I have changed the SONG_DIR, but it is still using the default. I removed the # in the beginning of the line, so it says:

SONG_DIR = "home/chris"

Error when video title contains `/` (slash)

I'm getting the following error:

➜ ytmdl avicii all i need
 ==> Searching Youtube for avicii all i need
 ==> Choose One
 [1] Avicii, Sia - "All I Need" | M/V by Avicii's Legacy
 [2] Avicii ft Sia - ID (All I Need) @Dubai World Trade Center 2016 by Amer Galadari
 [3] Avicii Ft. Sia - All I Need (Lyric Video) by AviciiFansTwo
 [4] Avicii - All I Need ◢ ◤ (feat. Sia) New Edit by Evann Av
 [5] Avicii, Sia - "All I Need" | M/V by Avicii's Legacy
 [0] More results
 ==> Enter Choice [a valid choice] 1
 ==> Downloading Avicii, Sia - "All I Need" | M/V in 320kbps
ERROR: [Errno 2] No such file or directory: '/home/jonas/Music/ytmdl/Avicii,#Sia#-#"All#I#Need"#|#M/V.mp3'
 ==> Downloaded!
 ==> Converting to mp3...
 ==> ERROR: [Errno 2] No such file or directory: '/home/jonas/Music/ytmdl/Avicii,#Sia#-#"All#I#Need"#|#M/V.mp3'

I suspect it might have to do with the / in the video title, as other videos can be downloaded fine.

Not relevant song data search result.

I was trying to download song of which I only remembered the channel name not the song name, luckily I found the song but while fetching the data about song I couldn't find the data as search results were based on the channel name that I had given for the search, instead of the song name.

P.S: I love the tool you have developed. Specially the song data fetching.

ytmdl not doing anything

I am getting some strange functionality. I have done the pip install, have v0.1-r8, and have run ytmdl -s. It doesn't actually do anything.

If I run ytmdl "Fractures" for example, it completes in 1 second with no output and not files written or anything. I also get no errors, it just returns. Same if I try to pass in a URL like ytmdl --url "https://www.youtube.com/watch?v=ZCu2gwLj9ok" "Fractures".

Some songs don't have data

They exist in iTunes, but when searched for they either don't appear in any of the 70 options or give the message "No data found". How are songs searched? Maybe different data methods would be better?

Examples:
That's what I like (Bruno Mars 24K Magic)
Giorgio by Moroder (Daft Punk Random Access Memories)

ERROR: 'total_bytes'

Sometimes this append :

==> Searching to see if already present in /mnt/raidz/slaan/KonectRadio/Playlist/Jazz
==> Searching Youtube for https://www.youtube.com/watch?v=W_UfkT2BGlE
==> Choose One
[1] Adrian Younge and Ali Shaheed Muhammad feat. Roy Ayers - "Synchronize Vibration" by Jazz Is Dead Official with dur 3:32
==> Enter Choice [a valid choice] 1
==> Downloading Adrian Younge and Ali Shaheed Muhammad feat. Roy Ayers - "Synchronize Vibration" in 320kbps
==> Saving the files to: home/user/.cache/ytmdl
==> 'total_bytes'
==> ERROR: 'total_bytes'

Syntax Error

Mac OSX Mojave, iterm2 w/ ZSH

Installed via pip, get the attached syntax error. My python is up to date (both 2 and 3).

Also had an issue with it installing on my Ubuntu box (19.10) this morning - wouldn't recognize it as a command after installing via pip. Haven't really had a chance to look further, but advice welcome.
Screen Shot 2019-11-15 at 09 28 20

Running ytmdl with no arguments fails

Title describes it, running ytmdl gives this error:

EDIT: I'm sorry if this is something once again caused by leftovers of my previous installation, I've done my best to clean it up and be in sync only with github.

Traceback (most recent call last):
  File "/usr/local/bin/ytmdl", line 4, in <module>
    __import__('pkg_resources').run_script('ytmdl==2019.11.15.post3', 'ytmdl')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1453, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/local/lib/python3.7/dist-packages/ytmdl-2019.11.15.post3-py3.7.egg/EGG-INFO/scripts/ytmdl", line 254, in <module>
  File "/usr/local/lib/python3.7/dist-packages/ytmdl-2019.11.15.post3-py3.7.egg/EGG-INFO/scripts/ytmdl", line 249, in extract_data
  File "/usr/local/lib/python3.7/dist-packages/ytmdl-2019.11.15.post3-py3.7.egg/EGG-INFO/scripts/ytmdl", line 96, in main
IndexError: list index out of range

Gives ERROR: list index out of range whenever I try to download anything

I used this nice little program a few months ago and recently came back to it. Before using it, I updated it to it's latest PyPi version. I then tried to download with it, but every time after I searched something and selected one of the Youtube videos on the list, the download failed and the program gave me ERROR: list index out of range. This happens with every search. Is there something I should do to alleviate this, or is it a bug in the program? Any help would be appreciated!

Download get gets slower over time.

I'm on arch, python 3.8, ryzen 7, gtx 1060
The issue occurs with the git version, the aur version and the pip version.
Whenever I download a song, it starts out with my normal internet speed and once it hits around 15-20%, it gets unbearably slow (going from estimated 10s to 5m and taking even longer).
Normal youtube-dl works fine, both from the shell and with the python bindings.
There's no unusual output in the terminal, it just gets very slow.

List Index Out of Range

ytmdl new divide
/usr/local/lib/python3.7/dist-packages/requests/init.py:91: RequestsDependencyWarning: urllib3 (1.25.7) or chardet (3.0.4) doesn't match a supported version!
RequestsDependencyWarning)
==> Searching Youtube for new divide
==> Choose One
[1] New Divide (Official Video) - Linkin Park by Linkin Park
[2] New Divide [Live in Red Square 2011] - Linkin Park by Linkin Park
[3] Linkin Park - New Divide (Lyrics) - GetThemLyrics by GetThemLyrics
[4] Transformers 2 ( Linkin Park - New Divide ) [HD] by SylverJack
[5] LINKIN PARK – NEW DIVIDE (Official Music Video) by Warner Music Germany
[0] More results
==> Enter Choice [a valid choice] 1
==> Downloading New Divide (Official Video) - Linkin Park in 320kbps
==> ERROR: list index out of range

Not relevant tag for songs

Hi,

I have an issue to tag correctly music I downloaded, below there is example :

[root@pc-root ytmdl]$ ytmdl --song single ladies
==> Searching to see if already present in /home/adeschamps/Musique
==> Searching Youtube for ladies
==> Choose One
[1] Beyoncé - Single Ladies (Put a Ring on It)
(Video Version) by Beyoncé with dur Durée 3:19
[2] Lee Fields & The Expressions - Ladies by franqus with dur Durée 4:18
[3] Travis Porter ft.Tyga - Ayy Ladies (Official Video) by Travis Porter with dur Durée 3:32
[4] Kool & The Gang - Ladies Night by soulbrothanumbahone with dur Durée 6:29
[5] Oryane ft. Sean Paul - Love Mi Ladies (Official Music Video) by Scorpio Music with dur Durée 2:50
[0] More results
==> Enter Choice [a valid choice] 1
==> Downloading Beyoncé - Single Ladies (Put a Ring on It) (Video Version) in 320kbps
==> Saving the files to: /home/adeschamps/.cache/ytmdl
3 MB | 1 Mb/s || ETA: 3 s |▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓| 100% ==> Downloaded!
==> Converting to mp3...
==> Getting song data for single...
==> Setting data...
==> Choose One
[1] Single by The Neighbourhood
[2] Single by Ne-Yo
[3] Single by Musiq Soulchild
[4] Beat It by Michael Jackson
[5] The Way You Make Me Feel by Michael Jackson
[0] More results

This song is very famous but the album provided are not accurate (it seems to be based on the song name)
Is this possible to guess the album name from the song name (I don't want to provide the album name) ?
Thank you for your answer

Using `ytmdl --list LIST` requires positional argument.

Forgive me if this is a trivial issue, but from reading the help message it seems that --list option takes a list of song names separated by newline, which means whatever songs I want to download is already included in that list. Therefore, the positional argument SONG_NAME isn't required since it's already included in LIST.

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

SONG_DIR with spaces

If I have a SONG_DIR with spaces in any of the names it doesn't work and reverts back to the default. Whether or not I do an escaped space or not

Ex:
SONG_DIR = "/home/user/Music/My Music$Artist->Album"
and
SONG_DIR = "/home/user/Music/My\ Music$Artist->Album"

I get this error when running ytmdl

Traceback (most recent call last):
File "/usr/local/bin/ytmdl", line 4, in
import('pkg_resources').run_script('ytmdl==2019.11.15.post2', 'ytmdl')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3089, in
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3072, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 574, in _build_master
ws.require(requires)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 892, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 778, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'ytmdl==2019.11.15.post2' distribution was not found and is required by the application
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/init.py", line 5, in
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in
import apt
File "/usr/lib/python3/dist-packages/apt/init.py", line 23, in
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
File "/usr/local/bin/ytmdl", line 4, in
import('pkg_resources').run_script('ytmdl==2019.11.15.post2', 'ytmdl')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3089, in
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3072, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 574, in _build_master
ws.require(requires)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 892, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 778, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'ytmdl==2019.11.15.post2' distribution was not found and is required by the application

ffmpeg is need by ytmdl

Hello !

At some point, ytmdl launch ffmpeg.

If it's not installed we get an error : ERROR: [Errno 2] No such file or directory: 'ffmpeg': 'ffmpeg'

I think we need to add a check at the very beginning of the executions, because this error apear after searching and selecting a song.

[Feature] Add support for Windows

Hey guys, thanks for all the love and support.

A few days ago an user asked me to add support for Windows if possible. I would love to add support but currently I'm using Linux full time and honestly I don't wanna go back to those horror days of using Windows, (yep, my machine specs aren't that good).

So if any user who's using Windows and would like to help adding support for it, please comment here.
If any of you guys know Python and use Windows, it'd be really helpful if you could make some PR's related to that.

I can look at the bug reports and make changes accordingly but that would take a lot of time, it'd be way easier for someone who uses and faces the bugs in Windows itself.

Thanks.!

Can't edit default folder

Hi,

The defaults can be changed by editing the config file in ytmdl folder in your .config folder

I have no ytmdl folder in my /home/pi/.config folder.

Sorry if this is basic, I'm discovering linux.

Organize Files

Add the ability to automatically organize downloaded files as well into the directory structure Artist -> Album -> Title.mp3

More information on config file

There isn't really any information in the github readme about what the config file should be named or how it's formatted, which is making ytmdl nearly impossible to configure properly. Specifically, I'm trying to get it to download a playlist and send separate videos to separate mp3 files, rather than just dumping everything in a single mp3, and it's not working properly. But I don't know if I'm just screwing up the config file because it's not really documented.

Can't find anything

ytmdl can't seem to find songs anymore. I even tried making it search taylor swift music, but it keeps returning the same error "No song found. Please try again with a different keyword.".

too many values to unpack (expected 2)

[omv@e964bd87a56f ytmdl]$ /usr/bin/ytmdl 'excavation the haxan cloak'
 ==> Searching to see if already present in /home/omv/ytmdl
 ==> Searching Youtube for excavation the haxan cloak
 ==> Choose One
 [1] The Haxan Cloak - Excavation (Part 1 & 2) by ADDA with dur 12:19
 [2] The Haxan Cloak - Excavation ALBUM REVIEW by theneedledrop with dur 6:42
 [3] Excavation (Part 1) by The Haxan Cloak - Topic with dur 8:10
 [4] The Haxan Cloak - Excavation (Part 1) by Pleasurable Pain with dur 8:10
 [5] Mix - The Haxan Cloak - Excavation (Part 1 & 2) by The Haxan Cloak - Excavation (Part 1 & 2) with dur Playlist
 [0] More results
 ==> Enter Choice [a valid choice] 1
 ==> Downloading The Haxan Cloak - Excavation (Part 1 & 2) in 320kbps
 ==> Saving the files to: /home/omv/.cache/ytmdl
Size: 6 MB
Saving as: /home/omv/.cache/ytmdl/The#Haxan#Cloak#-#Excavation#(Part#1#&#2).mp3
ERROR: too many values to unpack (expected 2)
 ==> Downloaded!
 ==> Converting to mp3...
Traceback (most recent call last):
  File "/usr/bin/ytmdl", line 4, in <module>
    __import__('pkg_resources').run_script('ytmdl==2019.11.15.post3', 'ytmdl')
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1469, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/EGG-INFO/scripts/ytmdl", line 230, in <module>
  File "/usr/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/EGG-INFO/scripts/ytmdl", line 225, in extract_data
  File "/usr/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/EGG-INFO/scripts/ytmdl", line 172, in main
  File "/usr/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/ytmdl/utility.py", line 52, in convert_to_mp3
AttributeError: module 'ffmpeg' has no attribute 'input'

Error while converting file to mp3

Tried downloading a song,
Download was complete, then it stopped and displayed the following error

Problems :

  1. No AlbumArt
  2. #The#Name#Is#Like#This
  3. The song doesn't play in my phone, but does on my laptop

Bruno#Mars#-#Grenade#[Official#Video].mp3 3.64 MB's |36 kbps| ETA: 0 s |--------------------| 100.00%
==> Downloaded!
==> Converting to mp3...
==> Something went wrong while converting!
==> Getting song data...
==> Setting data...
==> Choose One
[1] Grenade by Bruno Mars
[2] Grenade by Bruno Mars
[3] Grenade by Bruno Mars
[4] Grenade by .GRENADE
[5] Grenade by Power Music Workout
[0] More results
==> Enter Choice [a valid choice] 1
==> Something went wrong while writing data!

Something went wrong while downloading

I get the below message whenever attempting to run ytmdl regardless of whether I supply the URL or just the song name.

==> Something went wrong while downloading!

The version I have is v0.2-r4.

Is there a log kept anywhere or a way to get more verbose output to see what might be failing?

Fedora 31 can't launch / use ytmdl

pip3 install style:
Requirement already satisfied: ytmdl in /usr/local/lib/python3.7/site-packages (2019.11.15)
Requirement already satisfied: youtube_dl in /usr/lib/python3.7/site-packages (from ytmdl) (2019.11.28)
Requirement already satisfied: mutagen in /usr/local/lib/python3.7/site-packages (from ytmdl) (1.43.0)
Requirement already satisfied: itunespy in /usr/local/lib/python3.7/site-packages (from ytmdl) (1.5.5)
Requirement already satisfied: requests in /usr/lib/python3.7/site-packages (from ytmdl) (2.22.0)
Requirement already satisfied: colorama in /usr/local/lib/python3.7/site-packages (from ytmdl) (0.4.3)
Requirement already satisfied: bs4 in /usr/local/lib/python3.7/site-packages (from ytmdl) (0.0.1)
Requirement already satisfied: downloader-cli in /usr/local/lib/python3.7/site-packages (from ytmdl) (0.1.0.post2)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3.7/site-packages (from requests->ytmdl) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/lib/python3.7/site-packages (from requests->ytmdl) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python3.7/site-packages (from requests->ytmdl) (1.25.7)
Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.7/site-packages (from bs4->ytmdl) (4.8.2)
Requirement already satisfied: soupsieve>=1.2 in /usr/local/lib/python3.7/site-packages (from beautifulsoup4->bs4->ytmdl) (1.9.5)

Standard user install style from git clone:
$ sudo python3 setup.py install
WARNING: The wheel package is not available.
ERROR: Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-wheel-ldmwv1oe/future/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-741ytlj7:
ERROR: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help

error: invalid command 'bdist_wheel'

ERROR: Failed building wheel for future
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
subprocess.check_call(cmd)
File "/usr/lib64/python3.7/subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpcggwfv51', '--quiet', 'future']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "setup.py", line 43, in
setup_requires=req_pkgs
File "/usr/local/lib/python3.7/site-packages/setuptools/init.py", line 144, in setup
_install_setup_requires(attrs)
File "/usr/local/lib/python3.7/site-packages/setuptools/init.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/lib/python3.7/site-packages/pkg_resources/init.py", line 782, in resolve
replace_conflicting=replace_conflicting
File "/usr/local/lib/python3.7/site-packages/pkg_resources/init.py", line 1065, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python3.7/site-packages/pkg_resources/init.py", line 1077, in obtain
return installer(requirement)
File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
return fetch_build_egg(self, req)
File "/usr/local/lib/python3.7/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
raise DistutilsError(str(e))
distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpcggwfv51', '--quiet', 'future']' returned non-zero exit status 1.

FFMpeg is installed:
$ rpm -qa | grep -i ffmp
ffmpeg-4.2.1-3.fc31.x86_64
ffmpeg-devel-4.2.1-3.fc31.x86_64
ffmpeg-libs-4.2.1-3.fc31.x86_64
compat-ffmpeg28-2.8.15-4.fc31.x86_64

Current "which"/default ytmdl also fails:
/usr/local/bin/ytmdl money in the

==> Traceback (most recent call last):
File "/usr/local/bin/ytmdl", line 4, in
import('pkg_resources').run_script('ytmdl==2019.11.15.post3', 'ytmdl')
File "/usr/local/lib/python3.7/site-packages/pkg_resources/init.py", line 666, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python3.7/site-packages/pkg_resources/init.py", line 1469, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/EGG-INFO/scripts/ytmdl", line 255, in
File "/usr/local/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/EGG-INFO/scripts/ytmdl", line 250, in extract_data
File "/usr/local/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/EGG-INFO/scripts/ytmdl", line 111, in main
File "/usr/local/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/ytmdl/cache.py", line 88, in main
File "/usr/local/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/ytmdl/cache.py", line 58, in search
File "/usr/local/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/ytmdl/logger.py", line 95, in info
File "/usr/local/lib/python3.7/site-packages/ytmdl-2019.11.15.post3-py3.7.egg/ytmdl/logger.py", line 51, in _write
TypeError: expected str, bytes or os.PathLike object, not PosixPath

errors

Hello,

Installed with pip on a Linux Mint Sylvia machine.
I have this error:

==> Searching to see if already present in /home/arnauld/Music
==> Searching Youtube for back in black
==> Choose One
[1] AC/DC - Back In Black (Official Video) by AC/DC with dur Durée 4:15
[2] AC/DC - BACK IN BLACK MUSIC WITH LYRICS by Gonzalo with dur Durée 4:15
[3] Back In Black Full Album by Mathias Sánchez with dur Playlist
[4] AC/DC - Back In Black (Live At River Plate, December 2009) by AC/DC with dur Durée 4:01
[5] Amy Winehouse - Back To Black by Amy Winehouse with dur Durée 4:08
[0] More results
==> Enter Choice [a valid choice] 1
==> Downloading AC/DC - Back In Black (Official Video) in 320kbps
==> Saving the files to: /home/arnauld/.cache/ytmdl
ERROR: Signature extraction failed: Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/youtube_dl/extractor/youtube.py", line 1378, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python3.6/site-packages/youtube_dl/extractor/youtube.py", line 1256, in _extract_signature_function
raise ExtractorError('Cannot identify player %r' % player_url)
youtube_dl.utils.ExtractorError: Cannot identify player 'https://www.youtube.com/s/player/f676c671/player_ias.vflset/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
(caused by ExtractorError("Cannot identify player 'https://www.youtube.com/s/player/f676c671/player_ias.vflset/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
==> ERROR: Signature extraction failed: Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/youtube_dl/extractor/youtube.py", line 1378, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python3.6/site-packages/youtube_dl/extractor/youtube.py", line 1256, in _extract_signature_function
raise ExtractorError('Cannot identify player %r' % player_url)
youtube_dl.utils.ExtractorError: Cannot identify player 'https://www.youtube.com/s/player/f676c671/player_ias.vflset/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
(caused by ExtractorError("Cannot identify player 'https://www.youtube.com/s/player/f676c671/player_ias.vflset/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
==> ERROR: ERROR: Signature extraction failed: Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/youtube_dl/extractor/youtube.py", line 1378, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python3.6/site-packages/youtube_dl/extractor/youtube.py", line 1256, in _extract_signature_function
raise ExtractorError('Cannot identify player %r' % player_url)
youtube_dl.utils.ExtractorError: Cannot identify player 'https://www.youtube.com/s/player/f676c671/player_ias.vflset/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
(caused by ExtractorError("Cannot identify player 'https://www.youtube.com/s/player/f676c671/player_ias.vflset/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Thank you.

Error when running python setupConfig.py

Hello there !

I have managed to clone the ytmdl from GitHub and run the subsequent commands successfully, However, when running python setupConfig.py I'm getting this error

Traceback (most recent call last):
File "setupConfig.py", line 4, in
from pathlib import Path
ImportError: No module named pathlib

&feature=youtu.be stops the program

Hi,
Copy pasting URL with an ampersand after the video ID stops the program.
Removing it, it works.
(ytmdl https://www.youtube.com/watch?v=8fSpEYQUNpQ is alright)
Is it possible to trim it automatically?
Regards

ytmdl https://www.youtube.com/watch?v=8fSpEYQUNpQ&feature=youtu.be
[7] 26976
xxx@xxx:/ $  ==> Searching to see if already present in /home/pi/Syncthing/
 ==> Searching Youtube for https://www.youtube.com/watch?v=8fSpEYQUNpQ
 ==> Choose One
 [1] Moskau by Dschinghis Khan - Topic with dur Durée 4:31
 [2] Moskau - Dschinghis Khan (8-bit Soundfont) by NockeyNoo with dur Durée 4:19
 [3] How to easily make money on youtube by Rubix Cube with dur Durée 0:08
 [4] Moskau - Animation meme collab with SaikaTheCatto OvO by Adrieliu with dur Durée 0:55
 [5] The quadratic formula song (it's cringe) by KaijuBanjo with dur Durée 1:10
 [0] More results
 ==> Enter Choice [a valid choice] 1
bash: 1: command not found

[7]+  Stopped                 ytmdl https://www.youtube.com/watch?v=8fSpEYQUNpQ

very slow downloading

I really love the idea of his program - not being forced to leave the terminal to look for songs in a browser - now you can just stay in the terminal and search from there. Genius. But why is it so slow compared to youtube-dl.

ytmdl was at 80% I then downloaded the same song with youtube-dl and converted it to an audio file. When it was finished ytdml was still at 96% so there's something there that takes a lot of time. It's ok fpr a song or two I guess but if you want to download say 5-6 albums (50-60 songs) it will take a lot of time. Is there a way to speed it up?

Is it possible to use this as a library?

Hi there,

I wish to use this for song downloading as a replacement to YoutubeDL, due to its tagging capabilities.
Can I integrate it in my script? (via import)

Improve local search

Hi,
Thanks for mentioning me on the README.

I just went through the source code of ytmdl, especially the logic where the search is.
I saw the search module and it seems the search you are using is buggy search I had written before the improvement.
Can you look into this commit on how I have improved the local search:
NISH1001/playx@9fd464b

Originally, I had used Jaccard distance to try to match the total number of words that are common. But I have improved by using 2 levels of matching. Do give that commit message a read (and if possible the source code from playx).

Cheers.

Specify a YouTube URL

In the picture included in the README, it shows the YouTube URL being inputted. Add a flag to allow for this kind of interaction, like maybe -u URL.

Missing first word when search full album

Hi!
When you search for an album, the first word is missing, so I think that can affect the search.
I'm not able to find albums with more than two words in the title.
I tried with simple quotes, double even with backticks, but didn't works.

screenshot-20191115-16:12:29

screenshot-20191115-16:19:55


Also when I tried to search for an album with one word, it's fails.

Alice in Chains - Dirt
screenshot-20191115-16:24:56

Perl Jam - Ten
screenshot-20191115-16:25:31

May be I'm doing something wrong?!

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.