]> 472bisson.ca Git - c8518bb15a157e6f5dd27d62c2c6c343.git/blob - index.html
cc6baf37fed4d7e9a67fad7a9bc1378a6d534eb1
[c8518bb15a157e6f5dd27d62c2c6c343.git] / index.html
1 <!-- This tool generates a BitTorrent Magnet Link based on a given hash value and optionally a custom resource name. You can also provide the "hash" and "name" parameters as URL GET parameters, and they will be automatically filled into the form.
2
3 Customize the trackers by editing the list below. These will be included in the generated magnet link to ensure better availability and downloading speed.
4
5 Made with ♥ by Andrea Draghetti
6
7 This file may be licensed under the terms of of the GNU General Public License Version 3 (the ``GPL''). -->
8
9 <!DOCTYPE html>
10 <html lang="en">
11 <head>
12 <meta charset="utf-8">
13 <meta name="viewport" content="width=device-width, initial-scale=1.0">
14 <title>Magnet Link Generator - Generate Custom Magnet Links for BitTorrent</title>
15
16 <!-- Meta tags for SEO -->
17 <meta name="description" content="Generate custom torrent magnet links quickly and easily. Enter an info hash and torrent name to create a personalized magnet link with the latest trackers for optimal download speed.">
18 <meta name="keywords" content="Torrent Magnet Link Generator, BitTorrent Magnet Link, Custom Magnet Link, Torrent Hash Generator, Online Magnet Link Creator, BitTorrent Tracker, Torrent Generator">
19 <meta name="author" content="Andrea Draghetti">
20 <meta name="viewport" content="width=device-width, initial-scale=1.0">
21
22 <!-- Open Graph / Facebook -->
23 <meta property="og:type" content="website">
24 <meta property="og:url" content="https://magnet.draghetti.it">
25 <meta property="og:title" content="Torrent Magnet Link Generator - Generate Custom Magnet Links for BitTorrent">
26 <meta property="og:description" content="Easily create a custom BitTorrent magnet link by providing an info hash and torrent name. Automatically includes top trackers for better download performance.">
27 <meta property="og:image" content="https://magnet.draghetti.it/images/magnet-link-generator-thumbnail.png">
28
29 <!-- Twitter -->
30 <meta property="twitter:card" content="summary_large_image">
31 <meta property="twitter:url" content="https://magnet.draghetti.it">
32 <meta property="twitter:title" content="Torrent Magnet Link Generator - Generate Custom Magnet Links for BitTorrent">
33 <meta property="twitter:description" content="Easily create a custom BitTorrent magnet link by providing an info hash and torrent name. Includes top trackers for faster downloads.">
34 <meta property="twitter:image" content="https://magnet.draghetti.it/images/magnet-link-generator-thumbnail.png">
35
36 <!-- Favicon -->
37 <link rel="apple-touch-icon" sizes="180x180" href="https://magnet.draghetti.it/apple-touch-icon.png">
38 <link rel="icon" type="image/png" sizes="32x32" href="https://magnet.draghetti.it/favicon-32x32.png">
39 <link rel="icon" type="image/png" sizes="16x16" href="https://magnet.draghetti.it/favicon-16x16.png">
40 <link rel="manifest" href="https://magnet.draghetti.it/site.webmanifest">
41
42 <!-- Bootstrap CSS (version 5.3.3) with integrity check -->
43 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css" integrity="sha512-jnSuA4Ss2PkkikSOLtYs8BlYIeeIK1h99ty4YfvRPAlzr377vr3CXDb7sb7eEEBYjDtcYj+AjBH3FLv5uSJuXg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
44
45 </head>
46 <body class="d-flex flex-column align-items-center bg-light min-vh-100">
47
48 <div class="container bg-white shadow rounded p-4 mt-5">
49 <!-- Page title -->
50 <div class="text-center mb-4">
51 <h1 class="h4 fw-bold">BitTorrent Magnet Link Generator</h1>
52 </div>
53
54 <!-- Information section -->
55 <div class="text-secondary mb-4">
56 <p>This tool generates a BitTorrent Magnet Link based on a given hash value and optionally a custom resource name. You can also provide the "hash" and "name" parameters as URL GET parameters, and they will be automatically filled into the form.</p>
57 <p>Customize the trackers by editing the list below. These will be included in the generated magnet link to ensure better availability and downloading speed.</p>
58 </div>
59
60 <form name="form" onsubmit="update(); return false;">
61 <!-- Info hash input field -->
62 <div class="mb-3">
63 <label for="hash" class="form-label">Info Hash <small>(Mandatory)</small></label>
64 <input id="hash" type="text" class="form-control" placeholder="Enter the info hash" required>
65 </div>
66
67 <!-- Torrent name input field -->
68 <div class="mb-3">
69 <label for="name" class="form-label">Resource Name <small>(Optional)</small></label>
70 <input id="name" type="text" class="form-control" placeholder="Enter the resource name">
71 </div>
72
73 <!-- Generate button -->
74 <button type="submit" class="btn btn-primary w-100">Generate</button>
75
76 <!-- Generated Magnet Link display section -->
77 <div class="mt-3">
78 <a href="magnet:" id="link" class="text-primary fw-bold">Magnet Link</a>:
79 <input id="link_text" type="text" class="form-control mt-2" readonly>
80 </div>
81
82 <!-- Trackers list for customization -->
83 <div class="mb-3 mt-3">
84 <label for="trackers" class="form-label">Trackers to include in the magnet link:</label>
85 <textarea id="trackers" class="form-control" rows="6">http://tracker.opentrackr.org:1337/announce
86 udp://tracker.torrent.eu.org:451/announce</textarea>
87 <small class="form-text text-muted">These trackers are sourced from the <a href="https://github.com/ngosang/trackerslist" target="_blank">TrackersList project</a>.</small>
88 </div>
89 </form>
90 </div>
91
92 <!-- Footer with credit -->
93 <footer class="text-center mt-auto py-3 text-muted">
94 BitTorrent Magnet Link Generator made with ♥ by <a href="https://www.andreadraghetti.it/" target="_blank">Andrea Draghetti</a>.
95 </footer>
96
97 <!-- Bootstrap JS and dependencies (version 5.3.3) with integrity check -->
98 <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js" integrity="sha512-7Pi/otdlbbCR+LnW+F7PwFcSDJOuUJB3OxtEHbg4vSMvzvJjde4Po1v4BR9Gdc9aXNUNFVUY+SK51wWT8WF0Gg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
99
100
101 <script type="text/javascript">
102 /* Function to retrieve URL GET parameters */
103 function getUrlParameter(name) {
104 name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
105 var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
106 var results = regex.exec(location.search);
107 return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')).trim();
108 }
109
110 /* Function to auto-fill form fields if GET parameters are provided */
111 async function autoFillForm() {
112 var hashValue = getUrlParameter('hash');
113 var nameValue = getUrlParameter('name');
114
115 if (hashValue) {
116 document.getElementById("hash").value = hashValue.trim();
117 }
118 if (nameValue) {
119 document.getElementById("name").value = nameValue.trim();
120 }
121
122 // Wait for trackers to load before generating the link
123 await loadTrackers();
124
125 // Execute update only if hash is provided
126 if (hashValue) {
127 update();
128 }
129 }
130
131 /* Function to generate the magnet link */
132 function update() {
133 try {
134 var hashInput = document.getElementById("hash").value.trim().toUpperCase(); // Convert to uppercase
135 var nameInput = document.getElementById("name").value.trim();
136
137 // Set `name` to `hash` if it is empty
138 if (hashInput && !nameInput) {
139 document.getElementById("name").value = hashInput;
140 nameInput = hashInput; // Update variable
141 }
142
143 // Generate the magnet link
144 if (hashInput) {
145 var trackers = document.getElementById("trackers").value.match(/[^\s\|]+:\/\/[^\s\|]+/g);
146 var data = "magnet:" + "?xt=urn:btih:" + hashInput;
147
148 data += "&dn=" + encodeURIComponent(nameInput);
149
150 for (var t in trackers) {
151 data += "&tr=" + encodeURIComponent(trackers[t]);
152 }
153
154 document.getElementById("link").href = data;
155 document.getElementById("link_text").value = data;
156 } else {
157 // Clear the link_text field if hash is not present
158 document.getElementById("link_text").value = '';
159 }
160 } catch (e) {
161 alert("exception: " + e);
162 }
163 }
164
165 /* Automatically fill the form on page load if GET parameters are present */
166 window.onload = autoFillForm;
167 </script>
168
169 <script type="text/javascript">
170 // Function to load trackers from the external URL
171 async function loadTrackers() {
172 const url = "https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt";
173
174 try {
175 const response = await fetch(url);
176
177 if (response.ok) {
178 // Get the trackers list as text
179 let trackersList = await response.text();
180
181 // Remove empty lines
182 trackersList = trackersList
183 .split('\n') // Split into an array of lines
184 .filter(line => line.trim() !== '') // Remove empty lines
185 .join('\n'); // Rejoin into a single string
186
187 document.getElementById("trackers").value = trackersList;
188 } else {
189 console.error("Failed to load trackers: " + response.status);
190 }
191 } catch (error) {
192 console.error("Error fetching trackers: ", error);
193 }
194 }
195
196 // Load trackers on page load
197 window.onload = function() {
198 autoFillForm(); // Existing function to autofill form fields if URL parameters are provided
199 loadTrackers(); // Load trackers from the external source
200 };
201 </script>
202
203 </body>
204 </html>