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