Skip to content

Instantly share code, notes, and snippets.

@oSumAtrIX
Last active January 7, 2024 00:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oSumAtrIX/6abf46e2ea25d32f4e6608c3c3cf837e to your computer and use it in GitHub Desktop.
Save oSumAtrIX/6abf46e2ea25d32f4e6608c3c3cf837e to your computer and use it in GitHub Desktop.
Scripts to download titles on YouTube of Spotify with DownOnSpot

DownOnSpot protocol handler

Scripts to download titles on YouTube from Spotify with DownOnSpot.

Usage/ Installation

  1. Install the user script downonspot.userscript.js
  2. Put launch.ps1 next to the down_on_spot assembly or edit the path
  3. Add protocol handler associations with protocol_handler.reg. Replace the path to launch.ps1 to point to the right folder.
// ==UserScript==
// @name DownOnSpot
// @version 1.1
// @description Add a new event listener to the download button on YouTube to run DownOnSpot.
// @author oSumAtrIX
// @match https://www.youtube.com/watch?v=*
// ==/UserScript==
(() => {
'use strict';
let button;
const observer = new MutationObserver(mutations => {
if ((button = document.querySelector('#flexible-item-buttons > ytd-download-button-renderer > ytd-button-renderer')) == null) return
button.onclick = _ => { location.href = "downonspot:?" + document.querySelector("#container > h1 > yt-formatted-string").innerText }
observer.disconnect();
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();
cd $MyInvocation.MyCommand.Path.replace('launch.ps1', '')
[Reflection.Assembly]::LoadWithPartialName('System.Web') | Out-Null
$song = [System.Web.HttpUtility]::UrlDecode($args[0].replace('downonspot:?','').replace("'", '')) -replace '[^a-zA-Z0-9]', ' '
$selection = Read-Host -Prompt "Title [Default: '$($song)']"
if ($selection -ne ''){
$song = $selection
}
.\down_on_spot.exe $song
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\downonspot]
@="URL:downonspot"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\downonspot\shell]
[HKEY_CLASSES_ROOT\downonspot\shell\open]
[HKEY_CLASSES_ROOT\downonspot\shell\open\command]
@="Powershell.exe -File \"launch.ps1\" \"%1\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment