Last active
January 14, 2024 20:05
-
-
Save MysteryDash/fa0da022ff63205382d4edb8db3aa78a to your computer and use it in GitHub Desktop.
Adds a very naïve download link to sudomemo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Sudomemo Utilities | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2 | |
// @description Provide extra features to the sudomemo.net website! | |
// @author Alexandre QUONIOU | |
// @match https://*.sudomemo.net/watch/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=sudomemo.net | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js | |
// @grant GM_addStyle | |
// ==/UserScript== | |
(function() { | |
$(".Panel__body").after ( ` | |
<div class="Panel__foot Panel__foot--invert"> | |
<div class="WatchDetails__sharePanel SharePanel"> | |
<div class="SharePanel__head"> | |
<h4 class="SharePanel__title">Download</h4> | |
<div class="SharePanel__toggle"></div> | |
</div> | |
<div class="SharePanel__body"> | |
<a href="#" id="__Download">Download</a> | |
</div> | |
</div> | |
</div> | |
` ); | |
$('#__Download').on( "click", function() { | |
let playerSrc = $('.WatchPlayer__player').attr('src'); | |
let name = /sudomemo.net\/watch\/([a-z0-9]+)/g.exec(window.location.href)[1]; | |
fetch("https://archive.sudomemo.net" + playerSrc) | |
.then(res => { | |
return res.blob(); | |
}) | |
.then(blob => { | |
const href = window.URL.createObjectURL(blob); | |
const a = document.createElement("a"); | |
a.download = name + ".kwz"; | |
a.href = href; | |
a.click(); | |
a.href = ""; | |
}) | |
} );; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment