Skip to content

Instantly share code, notes, and snippets.

@cassdeckard
Last active December 3, 2025 01:11
Show Gist options
  • Select an option

  • Save cassdeckard/51ae42a9be307bcd91c7eccdc78a0731 to your computer and use it in GitHub Desktop.

Select an option

Save cassdeckard/51ae42a9be307bcd91c7eccdc78a0731 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name iMDB IPTorrents Search
// @namespace https://gist.github.com/cassdeckard
// @version 0.0.8
// @description Adds buttons to search for IMDB titles on IPTorrents
// @icon64 https://cdn-icons-png.flaticon.com/64/15207/15207992.png
// @icon https://cdn-icons-png.flaticon.com/32/15207/15207992.png
// @author Cass Deckard
// @match https://www.imdb.com/title/*
// @match https://www.imdb.com/search/title/*
// @match https://www.imdb.com/chart/*
// @license MIT
// @supportURL https://gist.github.com/cassdeckard/51ae42a9be307bcd91c7eccdc78a0731
// @downloadURL https://gist.github.com/cassdeckard/51ae42a9be307bcd91c7eccdc78a0731/raw/imdb-iptorrents-search.user.js
// @updateURL https://gist.github.com/cassdeckard/51ae42a9be307bcd91c7eccdc78a0731/raw/imdb-iptorrents-search.user.js
// ==/UserScript==
(function () {
'use strict';
let bitTorrentSvgHtml = `&nbsp;<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 194.8 194.8" width="16" height="16"><path d="M192.8 77.8c-1.3-6.3-3.2-12.4-5.7-18.3-2.4-5.8-5.5-11.3-9-16.6-3.5-5.2-7.5-10-11.9-14.4s-9.2-8.4-14.4-11.9c-5.2-3.5-10.8-6.5-16.6-9-5.9-2.5-12-4.4-18.3-5.7-6.4-1.3-13-2-19.6-2S84.2.7 77.8 2c-6.3 1.3-12.4 3.2-18.3 5.7-5.8 2.4-11.3 5.5-16.6 9-5.2 3.5-10 7.5-14.4 11.9S20.1 37.8 16.6 43c-3.5 5.2-6.5 10.8-9 16.6-2.5 5.9-4.4 12-5.7 18.3-1.3 6.4-2 13-2 19.6 0 6.6.7 13.2 2 19.6 1.3 6.3 3.2 12.4 5.7 18.3 2.4 5.8 5.5 11.3 9 16.6 3.5 5.2 7.5 10 11.9 14.4s9.2 8.4 14.4 11.9c5.2 3.5 10.8 6.5 16.6 9 5.9 2.5 12 4.4 18.3 5.7 6.4 1.3 13 2 19.6 2s13.2-.7 19.6-2c6.3-1.3 12.4-3.2 18.3-5.7 5.8-2.4 11.3-5.5 16.6-9 5.2-3.5 10-7.5 14.4-11.9s8.4-9.2 11.9-14.4c3.5-5.2 6.5-10.8 9-16.6 2.5-5.9 4.4-12 5.7-18.3 1.3-6.4 2-13 2-19.6-.1-6.7-.8-13.3-2.1-19.7zM97.4 182.6c-47.1 0-85.2-38.2-85.2-85.2s38.2-85.2 85.2-85.2 85.2 38.2 85.2 85.2c0 47.1-38.1 85.2-85.2 85.2z"/><path d="M98.9 175.3h2.3c.4 0 .8 0 1.2-.1h.1c.4 0 .7 0 1.1-.1h.3c.3 0 .6 0 .9-.1h.3c.3 0 .6-.1 1-.1h.2c.4 0 .8-.1 1.2-.1.4 0 .7-.1 1.1-.2h.2c.3 0 .6-.1.9-.1h.2c.4-.1.7-.1 1.1-.2.8-.1 1.6-.3 2.3-.5h.2c.3-.1.7-.1 1-.2h.1c.8-.2 1.5-.4 2.3-.6-9.6.3-17.4-1-22.3-2.1-11-2.4-21.5-6.7-30.4-14.1-14.8-12.4-22.4-30.2-22.2-47.9.1-13.2 4.6-26.4 13.7-37.2 11.4-13.5 27.6-20.6 44.2-21h2.3V37.4h-2.6c-5.1.1-10.1.7-15 1.8-5 1.1-9.8 2.8-14.4 4.9-4.7 2.2-9.1 4.9-13.2 8-4.2 3.2-8.1 6.9-11.5 11-3.2 3.8-6 7.9-8.3 12.3-2.3 4.2-4.1 8.7-5.5 13.3-1.3 4.5-2.3 9.2-2.7 13.9-.1 1.5-.2 2.9-.3 4.4v2.6c.1 5.1.7 10.1 1.8 15 1.1 5 2.8 9.8 4.9 14.4 2.5 5.5 7 13.6 13.7 19.7 13.2 10.4 29.9 16.6 48 16.6H98.9z"/><path d="M120.7 162.4c-4.6-.1-10.3-.8-14.7-1.6-20.6-3.7-38.3-16.3-44.8-35.3-7.9-23.1 4.2-48.1 27.2-55.7 4.5-1.5 9-2.2 13.6-2.2 5.9 0 11.8 1.2 17.2 3.4l5.6-11.9c-1.7-.7-3.4-1.3-5.1-1.9-5.7-1.8-11.7-2.7-17.7-2.7s-12 1-17.7 2.9c-7.3 2.4-14 6.3-19.7 11.4-2.7 2.4-5.3 5.2-7.5 8.1-2.2 2.9-4.1 6-5.7 9.3-1.6 3.3-2.9 6.7-3.8 10.2-.9 3.5-1.6 7.2-1.8 10.9-.5 7.6.5 15.2 3 22.4 2.5 7.3 6.5 14 12 19.9 4.9 5.3 10.6 9.3 17.5 13 7.2 3.8 16.1 5.8 25.4 7.1 6 .8 14 1 18.7 1 4.1-1.5 5.8-2.2 8-3.1 1.9-.9 3.8-1.8 5.7-2.9 1.9-1.1 2.2-1.3 5.4-3.4.3-.2.6-.4.8-.6-11 2-13.8 1.9-21.6 1.7z"/><path d="M145.3 147.6c-3.1.2-7.5.5-12.5.5-8.9 0-19.8-.8-29.1-3.9-14.4-4.8-28-17.1-28-32.3S88 84.5 103.1 84.5c10.3 0 19.2 5.7 23.9 14l11.9-5.9c-1.9-3.5-4.2-6.7-7.1-9.5-3.7-3.7-8.1-6.7-12.9-8.7-5-2.1-10.3-3.2-15.8-3.2s-10.8 1.1-15.8 3.2c-4.8 2-9.2 5-12.9 8.7-3.7 3.7-6.7 8.1-8.7 12.9-2.1 5-3.2 10.3-3.2 15.8s1.2 11 3.5 16.2c2.1 4.6 5 8.9 8.7 12.9 6.5 7 15.4 12.6 24.9 15.8 9.1 3 22.5 4.1 35.5 3.2 3.6-.2 6.3-.6 10.9-1.6 4.4-3.5 8.5-7.5 12-11.9-3 .3-8.7.9-12.7 1.2z"/></svg>`;
let insertLinks = function() {
// Find links with pattern /title/tt0000000/
let links = document.querySelectorAll(`a[href^="/title/tt"]`);
links.forEach(link => {
if (link.classList.contains(`ip-torrents-button`)) { return; }
link.classList.add(`ip-torrents-button`);
let title = link.textContent.trim();
if (title === ``) { return; }
let id = link.href.match(/tt\d+/)[0];
let button = document.createElement(`a`);
button.href = `https://iptorrents.com/search?q=${id}`;
button.target = `_blank`;
button.innerHTML = bitTorrentSvgHtml;
link.parentElement.appendChild(button);
});
};
insertLinks();
// find ul with class detailed-list-view or compact-list-view
let ul = document.querySelector(`ul.detailed-list-view, ul.compact-list-view`);
if (ul) {
// Listen for new content being added to the list items
let observer = new MutationObserver(insertLinks);
observer.observe(ul, { childList: true });
// observe the parent div as well
let parent = ul.parentElement;
observer.observe(parent, { childList: true });
}
})();
@cassdeckard
Copy link
Author

To install, click here

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