Skip to content

Instantly share code, notes, and snippets.

@4chenz
Last active April 17, 2023 23:26
Show Gist options
  • Save 4chenz/de3a3490aff19fd72e4fdd9b7dafc8f4 to your computer and use it in GitHub Desktop.
Save 4chenz/de3a3490aff19fd72e4fdd9b7dafc8f4 to your computer and use it in GitHub Desktop.
A userscript that links file hashes on usenet.
// ==UserScript==
// @name useneet archive
// @namespace Violentmonkey Scripts
// @match *://desuarchive.org/gif/*
// @match *://desuarchive.org/wsg/*
// @match *://archived.moe/gif/*
// @match *://archived.moe/wsg/*
// @grant none
// @updateURL https://gist.github.com/4chenz/de3a3490aff19fd72e4fdd9b7dafc8f4/raw/useneet.user.js
// @version 1.0
// @author -
// @description 7/7/2022, 10:38:01 AM
// ==/UserScript==
function insertA(el, hex){
elle = document.createElement('a');
elle.textContent = '[usenet]';
elle.setAttribute('href', 'https://nzbindex.com/search/?q='+hex);
elle.setAttribute('class', 'btnr parent');
el.appendChild(elle);
}
function useneet(element){
hex = base64ToHex ( element.querySelector('a').href.split('/')[6])
insertA(element, hex)
//console.log(hex);
}
function base64ToHex(str) {
for (var i = 0, bin = atob(str.replace(/_/g, '/').replace(/-/g, '+')), hex = []; i < bin.length; ++i) {
let tmp = bin.charCodeAt(i).toString(16);
if (tmp.length === 1) tmp = "0" + tmp;
hex[hex.length] = tmp;
}
return hex.join("");
}
document.querySelectorAll('.post_file_controls').forEach(e => useneet(e))
@perdakovich
Copy link

XSUsenet has close free plan how do I do it now?

@tebowy
Copy link

tebowy commented Apr 17, 2023

XSUsenet has close free plan how do I do it now?

get a cheap block at news demon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment