Last active
July 23, 2020 03:35
-
-
Save Fordi/d617a570adf0fd2621cce8b3c2465bb3 to your computer and use it in GitHub Desktop.
This file contains 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 Always Nova | |
// @match https://kissanime.ru/Anime/* | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
(async (window, document) => { | |
const qsa = (s, e = document) => [].slice.call(e.querySelectorAll(s)); | |
qsa('a[href]').forEach(link => { | |
const u = new URL(link.href); | |
if (/\/Anime\/[^\/]+\/[^\/]+/.test(u.pathname)) { | |
u.searchParams.set('s', 'nova'); | |
link.href = u.toString(); | |
} | |
}); | |
})(unsafeWindow, unsafeWindow.document); | |
})(); | |
This file contains 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 Fix Novelplanet links | |
// @match https://www.novelplanet.me/f/* | |
// @run-at document-end | |
// @updateUrl https://gist.githubusercontent.com/Fordi/d617a570adf0fd2621cce8b3c2465bb3/raw/Fix%2520Novelplanet%2520links.user.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
(async (vid, document) => { | |
const ofn = document.querySelector('.title').textContent | |
.replace(/\.(mp4|avi|webm|mpe?g|mov|mkv)$/, '') | |
.replace(/\s?\[[^\]]+\]\s?/g, ''); | |
const dl = document.querySelector('#downloads') | |
while (dl.firstChild) { | |
dl.removeChild(dl.firstChild); | |
} | |
const getLinks = async () => { | |
const { data } = await fetch(`/api/source/${vid}`, { method: 'post' }) | |
.then(response => response.text()) | |
.then(JSON.parse); | |
if (typeof data === 'string') { | |
dl.appendChild(document.createTextNode(data)); | |
} else { | |
data.forEach(entry => { | |
const p = document.createElement('p') | |
p.className = 'control'; | |
const a = document.createElement('a'); | |
a.className = 'button is-medium is-success clickdownload'; | |
a.href = entry.file; | |
a.download = `${ofn} [${entry.label}].${entry.type}`; | |
a.textContent = entry.label; | |
p.appendChild(a); | |
dl.appendChild(p); | |
p.appendChild(document.createElement('br')); | |
const button = document.createElement('button'); | |
button.textContent = 'Copy wget'; | |
p.appendChild(button); | |
button.addEventListener('click', () => { | |
const tmp = document.createElement('textarea'); | |
tmp.innerHTML = `wget "${entry.file}" --no-check-certificate -O "${ofn}.mp4"\n`; | |
document.body.appendChild(tmp); | |
tmp.select(); | |
document.execCommand('copy'); | |
document.body.removeChild(tmp); | |
}); | |
return p; | |
}); | |
} | |
}; | |
await getLinks(); | |
await getLinks(); | |
})(unsafeWindow.location.pathname.replace(/^.*\/f\/(.*)$/, '$1'), unsafeWindow.document); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment