Created
February 9, 2022 19:11
-
-
Save cyberdrop-me/49bba0d527872931f5e78cb72177c2ae 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 CyberDrop Auto-Archiver | |
// @description Automatically archive using the Internet Archive's Wayback Machine. | |
// @version 1 | |
// | |
// @match https://cyberdrop.me/a/* | |
// @match https://cyberdrop.to/a/* | |
// @match https://fs-*.cyberdrop.cc/* | |
// @match https://fs-*.cyberdrop.to/* | |
// @match https://img-*.cyberdrop.to/* | |
// @match https://f.cyberdrop.cc/* | |
// | |
// @grant GM_xmlhttpRequest | |
// @run-at document-start | |
// ==/UserScript== | |
(async () => { | |
const save_visited = true | |
const save_all_links = false | |
const save_all_links_no_host_restriction = true | |
const IAcookie = '' | |
const saveAllLinks = () => { | |
let sent_array = [] | |
for (let elements1 = document.getElementsByTagName('a'), i = elements1.length - 1; i >= 0; i--) { | |
const URL1 = decodeURI(elements1[i].href) | |
if ((save_all_links_no_host_restriction || URL1.match(location.hostname)) && -1 === sent_array.indexOf(URL1)) { | |
sent_array[sent_array.length] = URL1 | |
GM_xmlhttpRequest({ | |
method: 'POST', | |
url: `http://web.archive.org/save/${encodeURI(URL1)}`, | |
data: `url=${encodeURI(URL1)}&capture_outlinks=on&capture_all=on&capture_screenshot=on`, | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded', | |
'cookie': IAcookie, | |
'referer': 'https://web.archive.org/save' | |
} | |
}) | |
console.log('http://web.archive.org/' + encodeURI(URL1)) | |
// Print URI lists you have sent the request to save. (on console, for debug) | |
} | |
} | |
} | |
// Save the page you have just visited. | |
if (save_visited) { | |
GM_xmlhttpRequest({ | |
method: 'POST', | |
url: `http://web.archive.org/save/${encodeURI(decodeURI(location.href))}`, | |
data: `url=${encodeURI(decodeURI(location.href))}&capture_outlinks=on&capture_all=on&capture_screenshot=on`, | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded', | |
'cookie': IAcookie, | |
'referer': 'https://web.archive.org/save' | |
} | |
}) | |
console.log('http://web.archive.org/' + encodeURI(decodeURI(location.href))); | |
}; | |
// Save all links you can see on a page. | |
if (save_all_links) { | |
setTimeout(function() { | |
saveAllLinks() | |
}, 5000) | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment