Skip to content

Instantly share code, notes, and snippets.

@okitavera
Last active September 28, 2023 18:37
Show Gist options
  • Save okitavera/7287970e79fe02e518e5 to your computer and use it in GitHub Desktop.
Save okitavera/7287970e79fe02e518e5 to your computer and use it in GitHub Desktop.
Convert Youtube video to MP3 using ThatMP3.com
// ==UserScript==
// @name Youtube MP3 Converter
// @namespace www.thatmp3.com
// @description Convert YouTube to MP3 with album art & ID3 tags automatically fixed!
// @include https://www.youtube.com/*v=*
// @version 0.1
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant unsafeWindow
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
$(function(){
var eappend = ".watch-secondary-actions.yt-uix-button-group";
function runMe(e){
var ytID = new RegExp("v=([^&]+)", "i").exec(window.location.search);
var link = "http://www.thatmp3.com/download="+unescape(ytID[1]);
var res = '<div class="yt-uix-menu yt-uix-videoactionmenu "><a href="'+link+'" target="_blank" class="yt-uix-button yt-uix-button-size-default yt-uix-button-opacity yt-uix-button-has-icon no-icon-markup yt-uix-videoactionmenu-button addto-button pause-resume-autoplay yt-uix-menu-trigger yt-uix-tooltip">Download</a></div>';
$(e).prepend(res);
}
waitForKeyElements(eappend,runMe);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment