Now the rss feed returns magnet links, but still with broken URL escaping on the torrent name part of the magnet URI (dn querystring value):
magnet:?xt=urn:btih:8b774f03e001086aa9632db1b137bfee73fbca0c&dn=Metallica - Hardwired…To Self-Destruct (2016) MP3&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Feddie4.nl%3A6969&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969&tr=udp%3A%2F%2Fopentrack
URI constructor throws this exception:
java.net.URISyntaxException: Illegal character in scheme specific part at index 73: magnet:?xt=urn:btih:8b774f03e001086aa9632db1b137bfee73fbca0c&dn=Metallica - Hardwired…To Self-Destruct (2016) MP3&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Feddie4.nl%3A6969&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969&tr=udp%3A%2F%2Fopentrackr.org%3A1337&tr=udp%3A%2F%2Ftracker.zer0day.to%3A1337
We previously had the same issue when the rss item link was a HTTP URL (https://github.com/erickok/transdroid-search/pull/58), I fixed it by exploiting the fact that java.net.URL accepts such invalid urls, and re-constructed a proper URI using java.net.URI, from the parsed URL. The URI constructor properly encoded the path part, assuming it was not encoded yet.
However, now that the link is a magnet link URI, this workaround fails: the URL constructor rightly refuses the magnet protocol (it's not an URL): java.net.MalformedURLException: Unknown protocol: magnet
I'll try to contact the maintainer of skytorrents, because I don't know how to correct the URI without rewriting a URI parser + querystring parser, because we cannot just url-encode everything: the rest of the magnet querystring parameters would wrongly be encoded two times.
Now the rss feed returns magnet links, but still with broken URL escaping on the torrent name part of the magnet URI (
dn
querystring value):magnet:?xt=urn:btih:8b774f03e001086aa9632db1b137bfee73fbca0c&dn=Metallica - Hardwired…To Self-Destruct (2016) MP3&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Feddie4.nl%3A6969&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969&tr=udp%3A%2F%2Fopentrack
URI constructor throws this exception:
We previously had the same issue when the rss item link was a HTTP URL (https://github.com/erickok/transdroid-search/pull/58), I fixed it by exploiting the fact that java.net.URL accepts such invalid urls, and re-constructed a proper URI using java.net.URI, from the parsed URL. The URI constructor properly encoded the path part, assuming it was not encoded yet. However, now that the link is a magnet link URI, this workaround fails: the URL constructor rightly refuses the
magnet
protocol (it's not an URL): java.net.MalformedURLException: Unknown protocol: magnetI'll try to contact the maintainer of skytorrents, because I don't know how to correct the URI without rewriting a URI parser + querystring parser, because we cannot just url-encode everything: the rest of the magnet querystring parameters would wrongly be encoded two times.
If anyone has another solution, PR are welcome !