Greasy Fork is available in English.
Converts 40-char hex hashes into clickable magnet links
Turn plain text 40-character hexadecimal hashes into clickable Magnet links automatically.
Have you ever browsed a forum, tracker, or pastebin where users share BitTorrent info hashes as plain text (e.g., eae4e4eeaf7096dad1e876efd894125e4a1baa3b) instead of clickable links?
This script solves that problem. It scans the webpage, detects valid SHA-1 hashes, and converts them into clickable magnet: links instantly.
<input>, <textarea>, <script>, <style>, and existing <a> tags to prevent breaking page functionality.TreeWalker to modify text nodes directly, preserving event listeners on parent elements.MutationObserver. If you scroll down on a page with "Infinite Scroll" or load content via AJAX, the new hashes will be autolinked automatically.Before:
Here is the hash for the file: 5b3267325e3d233c675f3243f234567890abcdef
After:
Here is the hash for the file: 5b3267325e3d233c675f3243f234567890abcdef
\b[a-fA-F0-9]{40}\b.magnet:?xt=urn:btih:[HASH].If you want to change the color of the generated links, look for this section in the code:
a.style.color = 'green'; // Change 'green' to 'red', '#ff0000', etc.
a.style.fontWeight = 'bold';