Welcome to the public version of mine currently private project called yaytd (Yet Another YouTube Downloader).
I decided to implement this one using NodeJS & PowerShell for my own simplicity.
yaytd allows you to run localhost HTTP server that will serve yt-dl API and lets you cache requests/downloads.
(Primarily, this tool has been designed for use by Garry's Mod community; to make it possible to create fancy ingame music players via ingame scripting...)
Make sure you have all of the following (items marked with *
are optional):
- NodeJS (v14.17.0 or higher)
- PowerShell / Win10Store (v7.1.3 or higher)
- ffmpeg / BtbN
*
(v4.4 or higher) - Dropbox
- Dropbox account (it is free)
If you already had installed NodeJS previously, please make sure to check your installed version by running (in Command Prompt or Terminal):
node --version
To get started, you would need to clone/download this repository to your computer. This should be straightforward, open up Command Prompt or Terminal, and then enter the following:
git clone https://github.com/Cheatoid/yaytd-public
Or alternatively, download the ZIP file and extract it on your computer.
At this point you should have yaytd downloaded on your computer.
This is one-time process (you would only need to do this only once):
- Open Terminal/PowerShell and run
.\!yaytd.ps1 -dropbox "YOUR_DROPBOX_FOLDER"
, but replaceYOUR_DROPBOX_FOLDER
with folder path to your Dropbox folder.
For example, the default Dropbox location for Windows OS is inside your user profile folder (%UserProfile%\Dropbox
).
From this point onwards, launching yaytd is as simple as running .\!yaytd.ps1
PowerShell script (double-click it).
If this is your first time using NodeJS application, click here to see extra step.
You may receive Windows Firewall popup which looks like this:
Just click Allow access
button. (It may prompt for UAC, but you would just need to do this only once.)
If you have done everything correctly, local HTTP server should be operating at this point.
By default, HTTP server will try to use the port number 60999
.
To quickly test if yaytd is working, click this example GET link in your web browser:
http://localhost:60999/fetch/?url=bM7SZ5SBzyY&download=1
It will fetch and download this YouTube audio into your local cache folder, therefore subsequent HTTP request (for the same YouTube audio) will be much faster.
Additionally, if you have ffmpeg
installed (you should have it on your system PATH
), then you can also take advantage of automatically converting audio into MP3 format, to do this, simply append &mp3=1
to the end of URL:
http://localhost:60999/fetch/?url=bM7SZ5SBzyY&download=1&mp3=1
Note: Once audio has been cached, both download
and/or mp3
options will have no effect. To fix this, delete a json file for particular audio and repeat the HTTP request.
Occasionally, youtube-dl will become outdated, simply run the .\!yaytd.ps1 -update
to automatically update it to their latest released version.
In order to play music ingame (via scripting), you must obtain a direct link to particular audio file, on Windows you can right-click on the file in your Dropbox yaytd-cache
folder and then choose Copy Dropbox link
.
Here are some URL examples of what you can expect to work (or not to work):
β https://www.dropbox.com/s/e9ld2pt8z4wq4va/bM7SZ5SBzyY.webm?dl=0
βοΈ https://www.dropbox.com/s/e9ld2pt8z4wq4va/bM7SZ5SBzyY.webm?dl=1
βοΈ https://dl.dropboxusercontent.com/s/e9ld2pt8z4wq4va/bM7SZ5SBzyY.webm
...
Happy tunes.