Skip to content

Commit

Permalink
update encode url and param
Browse files Browse the repository at this point in the history
  • Loading branch information
Lifailon authored Jun 4, 2024
1 parent 7073e25 commit 54fdcdb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ the operating system will redirect you to the default torrent client.

---

The `#tr` parameter adds a list of torrent tracker servers to the magnet link:
The `&tr` parameter adds a list of torrent tracker servers to the magnet link:

```
https://lifailon.github.io/magnet2url#7395a859e8e590418f422e7d0dfe68860de90631#tr
https://lifailon.github.io/magnet2url#7395a859e8e590418f422e7d0dfe68860de90631&tr
```

redirect to

```
magnet:?xt=urn:btih:7395A859E8E590418F422E7D0DFE68860DE90631&tr=wss://tracker.btorrent.xyz&tr=wss://tracker.openwebtorrent.com&tr=udp://tracker.btorrent.xyz:80&tr=udp://tracker.openwebtorrent.com:80&tr=udp://tracker.openwebtorrent.com:1337&tr=udp://retracker.local:80&tr=udp://tr0.torrent4me.com:80&tr=udp://tr1.torrent4me.com:80&tr=udp://tr2.torrent4me.com:80&tr=udp://tr3.torrent4me.com:80&tr=udp://tr4.torrent4me.com:80&tr=udp://tr0.tor4me.info:80&tr=udp://tr1.tor4me.info:80&tr=udp://tr2.tor4me.info:80&tr=udp://tr3.tor4me.info:80&tr=udp://tr4.tor4me.info:80&tr=udp://tr0.tor2me.info:80&tr=udp://tr1.tor2me.info:80&tr=udp://tr2.tor2me.info:80&tr=udp://tr3.tor2me.info:80&tr=udp://tr4.tor2me.info:80
magnet:?xt=urn:btih:7395a859e8e590418f422e7d0dfe68860de90631&tr=http://tr0.torrent4me.com/ann?uk=kCm7WcIM00&tr=http://tr1.torrent4me.com/ann?uk=kCm7WcIM00&tr=http://tr2.torrent4me.com/ann?uk=kCm7WcIM00&tr=http://tr3.torrent4me.com/ann?uk=kCm7WcIM00&tr=http://tr4.torrent4me.com/ann?uk=kCm7WcIM00&tr=http://tr5.torrent4me.com/ann?uk=kCm7WcIM00&tr=http://tr0.tor4me.info/ann?uk=kCm7WcIM00&tr=http://tr1.tor4me.info/ann?uk=kCm7WcIM00&tr=http://tr2.tor4me.info/ann?uk=kCm7WcIM00&tr=http://tr3.tor4me.info/ann?uk=kCm7WcIM00&tr=http://tr4.tor4me.info/ann?uk=kCm7WcIM00&tr=http://tr5.tor4me.info/ann?uk=kCm7WcIM00&tr=http://tr0.tor2me.info/ann?uk=kCm7WcIM00&tr=http://tr1.tor2me.info/ann?uk=kCm7WcIM00&tr=http://tr2.tor2me.info/ann?uk=kCm7WcIM00&tr=http://tr3.tor2me.info/ann?uk=kCm7WcIM00&tr=http://tr4.tor2me.info/ann?uk=kCm7WcIM00&tr=http://tr5.tor2me.info/ann?uk=kCm7WcIM00&tr=http://retracker.local/announce&tr=wss://tracker.openwebtorrent.com&tr=wss://tracker.openwebtorrent.com
```
7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
var messageElement = document.getElementById("message")
var hashValue = window.location.hash.substr(1)
if (hashValue) {
if (hashValue.startsWith("magnet:?xt=urn:btih:")) {
if (hashValue.startsWith("magnet:?xt=urn:btih:") || hashValue.startsWith("magnet%3A%3Fxt%3Durn%3Abtih%3A")) {
window.location.href = hashValue
}
else {
var magnet = "magnet:?xt=urn:btih:" + hashValue
if (magnet.includes("#tr")) {
magnet = magnet.split('#tr')[0]
if (magnet.includes("&tr") || magnet.includes("%2523")) {
magnet = magnet.split("&tr")[0]
magnet = magnet.split("%2523")[0]
var magnetTrackerServerList = addTrackerServerList(magnet)
window.location.href = magnetTrackerServerList
}
Expand Down

0 comments on commit 54fdcdb

Please sign in to comment.