Youtube TMS Finder

This code was made in an effort to make it easier to find the song that has been dubbed as 'the most mysterious song on the internet' and it makes it possible to search youtube channels for songs without having to manually check the videos.

To find unidentified music.

What you need to know

This code was made in an effort to make it easier to find the song that has been dubbed as 'the most mysterious song on the internet' and it makes it possible to search youtube channels for songs without having to manually check the videos. This is done by crawling their YouTube channel, downloading a video if it is under 4 minutes long, fingerprinting the audio, and checking it against a database (the database which is included in this program). It was developed for Windows so people don't have to install virtual machines or WSL subsystems or anything like that, and also because my university administrator doesn't allow changing operating systems. But it should work on Linux as well.

The necessary code was already available, I just made them work together.

Credits & contributors:

  • Credit to the makers of youtube-dl
  • Special thanks and credit to Itspoma, the creator of the audio fingerprinting and recognition code.
  • Thanks to nrsyed for helping with code optimisation.
  • Thanks to Tamago-iku for contributing.

How to use

Usage:

find_stable.py [-h] [-i] [-s] [-v] [-t THRESHOLD] [-m THREADS] [-c CHANNEL_URL] [-id ID] [-r RESTORE_FILE]
  1. -h for the help message.
  2. -i ignore videos that were checked in another session already.
  3. -s download only first 30 seconds of video. This speeds up the download and fingerprinting.
  4. -v for verbosity.
  5. -t to set the hash matches threshold (at which you will be notified of a match)
  6. -m multithreading, max number of videos to check at the same time, 3 is optimal
  7. -c to supply channel URL from command line, if this is not supplied, it will be asked automatically.
  8. -id to check only one video ID
  9. -r for restore file (This restore file has to be the html source of a youtube channel)

The restore file is automatically created after the first time you grab the HTML of a YouTube channel.

Some unidentified music we find is different in BPM/pitch, therefore this package with slightly different versions of TMS is available. Just put the files in the "mp3" folder and do python collect-fingerprints-of-songs.py.

How to set up on Windows

  1. Make sure you have python 3 installed.

  2. Open a command prompt and install the requirements:

    pip install -r requirements.txt

  3. Do you have problems installing PyAudio? Please skip to the next step.

  4. To make the installation easier, we'll use chocolately which is just like brew, pip, or other module utilities. Open up CMD in the administrator mode and do this command:

    @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

68747470733a2f2f692e6962622e636f2f646d4e334476562f63686f63686f2d696e7374616c6c2e706e67

  1. Great! Now you have Chocolately installed. Next we'll install the chromedriver. If you already have the chromedriver you can skip this step. Close the previous CMD window and open a new CMD in administrator mode, run:

    choco install chromedriver

  2. In order to download audio from YouTube we'll need ffmpeg. We'll download this now. If you already have ffmpeg you can skip this step. In the same CMD window, run:

    choco install ffmpeg -y

  3. If you had any problems with installing PyAudio, that's a common issue. The solution to downloading PyAudio if the normal pip install pyaudio fails, is this: Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio and download the .whl file for your version of python. Then open up a command prompt (press Windows key and type CMD). Navigate to the folder with the .whl file and do pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl or whatever .whl file suits your version of python. Now you have it installed.

  4. Now do: python find_stable.py

  5. Check for any matches! This will be displayed and a file called "MATCHES.txt" will be created in the folder so you don't have to check the progress constantly.

How to set up on Linux

  1. Make sure you have Python 3 installed.

  2. Open a terminal and install the requirements:

    $ pip install -r requirements.txt

  3. Do you have problems installing PyAudio? Please skip to the next step.

  4. Installing ffmpeg:

    sudo apt install software-properties-common
    sudo apt update
    sudo add-apt-repository ppa:jonathonf/ffmpeg-4
    sudo apt install ffmpeg

  5. In case you have any problems with installing PyAudio, please check out this

  6. To install the chromedriver on Linux: please go see here

  7. Then do: python find_stable.py

GitHub

https://github.com/Ben-0-mad/YT-TMS-Finder