Skip to content

Instantly share code, notes, and snippets.

@cute-angelia
Last active July 4, 2024 02:53
Show Gist options
  • Select an option

  • Save cute-angelia/f059b64afd718f29b83ba51e8f6c2221 to your computer and use it in GitHub Desktop.

Select an option

Save cute-angelia/f059b64afd718f29b83ba51e8f6c2221 to your computer and use it in GitHub Desktop.
test
// ==UserScript==
// @name MyEpisodes torrent finder
// @version 1.4.0
// @author You
// @match https://www.myepisodes.com/views.php*
// @match https://www.myepisodes.com/quickcheck/
// @icon https://www.google.com/s2/favicons?sz=64&domain=www.myepisodes.com
// @grant GM_addStyle
// @updateURL https://gist.githubusercontent.com/bre7/99be2fe91cc52c93fd0388f0640beffc/raw
// ==/UserScript==
function addStyles() {
GM_addStyle('.links { width:15%; text-align: center; }');
}
function TPBLink(showName, showSeason, showEpisode) {
return `https://thepiratebay.org/search/${showName} s${showSeason}e${showEpisode}%20x265/0/99/0`
}
function icon(className) {
return `<div class="torrentIcon ${className}"></div>`
}
function RARBGLink(showName, showSeason, showEpisode) {
return `https://rarbg.to/torrents.php?search=${showName.replaceAll("'", "")} s${showSeason}e${showEpisode}`
}
function x1377Link(showName, showSeason, showEpisode) {
return `https://www.1377x.to/sort-search/${showName.replaceAll("'", "")} s${showSeason}e${showEpisode}/time/desc/1/`
}
function magnetDlLink(showName, showSeason, showEpisode) {
return `https://www.magnetdl.com/i/${showName.replaceAll("'", "")} s${showSeason}e${showEpisode}/`.replaceAll(" ", "-").toLowerCase()
}
function megaLink(showName, showSeason, showEpisode) {
return `https://www.reddit.com/r/megalinks/search?q=${showName.replaceAll("'", "")} s${showSeason}e${showEpisode}&restrict_sr=on&sort=new&t=all`
}
function addTorrentLinks() {
const table = document.querySelector(`#myepisodes_views table.mylist`)
const showNameHeader = table.querySelector(`tbody tr.header:nth-child(1) th:nth-child(3)`)
let newHeader = showNameHeader.cloneNode(true)
newHeader.textContent = `Torrent`
showNameHeader.insertAdjacentElement(`afterend`, newHeader)
table.querySelectorAll(`th.headershowname`).forEach((el, i) => {
el.colSpan = el.colSpan + 1
})
table.querySelectorAll(`td.showname`).forEach((el, i) => {
const searchLinks = (() => {
if ( el.parentNode.classList.contains('past') || el.parentNode.classList.contains('today') ) {
const showname = el.querySelector('a').textContent.normalize('NFKD').replace(/[\u0300-\u036f]/g, "")//.replace(/[^\w]/g, '')
const seasonEpNumber = el.parentNode.querySelector('td.longnumber').textContent.split('x')
const ssnnum = seasonEpNumber[0]
const epnum = seasonEpNumber[1]
return `<td class="links"><a href="${TPBLink(showname, ssnnum, epnum)}">tpb</a> | <a href="${x1377Link(showname, ssnnum, epnum)}">1377x</a> | <a href="${magnetDlLink(showname, ssnnum, epnum)}">magnetDL</a></td>`
} else if (window.location.pathname === `/quickcheck/`) {
const showname = el.querySelector('a').textContent.normalize('NFKD').replace(/[\u0300-\u036f]/g, "")//.replace(/[^\w]/g, '')
const seasonEpNumber = el.parentNode.querySelector('td.longnumber').textContent.split('x')
const ssnnum = seasonEpNumber[0]
const epnum = seasonEpNumber[1]
return `<td class="links"><a href="${TPBLink(showname, ssnnum, epnum)}">tpb</a> | <a href="${x1377Link(showname, ssnnum, epnum)}">1377x</a> | <a href="${magnetDlLink(showname, ssnnum, epnum)}">magnetDL</a></td>`
} else {
return `<td class="links"></td>`
}
})()
el.insertAdjacentHTML(`afterend`, searchLinks)
})
}
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
ready( () => {
addStyles();
setTimeout(addTorrentLinks, 2_000);
})
// ==UserScript==
// @name Canvas Donwloader
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://seiga.nicovideo.jp/watch/mg*a
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
$(document).ready(function(){
$('body').prepend('<div class="canvas_dl_area" style="position:fixed; top: 50%; right: 0; z-index: 100; transform: translateY(-50%); width: 153px;"><div class="canvas_dl_spawn" style="background: #efefef; cursor: pointer; padding: 6px;">CANVAS DOWNLOAD LINK GENELATOR</div><div class="canvas_dl_btn_area"</div>');
$(document).on('click', '.canvas_dl_spawn', function(){
var $pages = $('#page_contents .page');
$('.canvas_dl').remove();
$pages.each(function(i, e){
var $c = $(this).find('canvas').not('.balloon'),
c = $c[0],
pNum = i+1;
$(this).prepend( $('<a class="canvas_dl" href="'+c.toDataURL('image/jpeg')+'" download="'+pNum+'.jpg" style="display: inline-block; position:absolute; z-index: 100; background: #333; color: #fff; padding: 6px;">'+pNum+'.jpg</a>') );
$('.canvas_dl_btn_area').append( $('<a class="canvas_dl" href="'+c.toDataURL('image/jpeg')+'" download="'+pNum+'.jpg" style="display: inline-block; background: #333; color: #fff; padding: 6px;">'+pNum+'.jpg</a>') );
});
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment