B4J Question Http Post problem

Peter Lewis

Active Member
Licensed User
Longtime User
I am trying to post a magnet link which normally activates the downloaded from the default browser. If I put the string in the address bar , it works correctly but if I try and post the string , it gives me a invalid url

B4X:
Dim hjob As HttpJob
    hjob.Initialize("",Me)
        Dim ps As String =  "magnet:?xt=urn:btih:58B778AC42451F557C5A556369FABE351F506BB7&dn=The.Young.and.the.Restless.S52E09.1080p.WEB.h264-DiRT%5BEZTVx.to%5D.mkv&tr=udp%3A%2F%2Fglotorrents.pw%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftorrent.gresille.org%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com%3A1337&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337"
     hjob.Poststring(ps,"")
        wait for (hjob) jobdone(j As HttpJob)
    hjob.Release

Any Ideas ?, Thank you
 

drgottjr

Expert
Licensed User
Longtime User
my understanding is that you would need a bittorrent client to suck the url out. it's how desktop browsers would handle it. our okhttputils are designed around a so-called "httpclient" which only understands http requests. once you retrieved the actual url of the magnet, you can return to okhttp for a request. you might find an online torrentclient with an api. you might be able to use okhttp to communicate with it. i believe it's - more or less - what chrome does; it passes the magnet urn to somebody who can handle it.
 
Upvote 0

Peter Lewis

Active Member
Licensed User
Longtime User
my understanding is that you would need a bittorrent client to suck the url out. it's how desktop browsers would handle it. our okhttputils are designed around a so-called "httpclient" which only understands http requests. once you retrieved the actual url of the magnet, you can return to okhttp for a request. you might find an online torrentclient with an api. you might be able to use okhttp to communicate with it. i believe it's - more or less - what chrome does; it passes the magnet urn to somebody who can handle it.
Correct the default has a hook to start the external Torrent client. I thought that by posting the Magnet to the browser it would trigger the external torrent client, mainly because if I paste the magnet link in the browser, it works perfectly.

I will look for a torrent client with an API interface

These are the options in the RSS feed

B4X:
<item>
<title>High Potential S01E04 480p x264-mSD</title>
<category>TV</category>
<link>https://eztvx.to/ep/2377895/high-potential-s01e04-480p-x264-msd/</link>
<guid>https://eztvx.to/ep/2377895/high-potential-s01e04-480p-x264-msd/</guid>
<pubDate>Wed, 16 Oct 2024 02:18:18 +0200</pubDate>
<torrent:contentLength>258980867</torrent:contentLength>
<torrent:infoHash>5EFE9940FC6EC673B2252FDE34E43155A7671CAD</torrent:infoHash>
<torrent:magnetURI>
<![CDATA[ magnet:?xt=urn:btih:5EFE9940FC6EC673B2252FDE34E43155A7671CAD&dn=High.Potential.S01E04.480p.x264-mSD%5BEZTVx.to%5D.mkv&tr=udp%3A%2F%2Fglotorrents.pw%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftorrent.gresille.org%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com%3A1337&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337 ]]>
</torrent:magnetURI>
<torrent:seeds>0</torrent:seeds>
<torrent:peers>0</torrent:peers>
<torrent:verified>0</torrent:verified>
<torrent:fileName>High.Potential.S01E04.480p.x264-mSD[EZTVx.to].mkv</torrent:fileName>
<enclosure url="https://zoink.ch/torrent/High.Potential.S01E04.480p.x264-mSD[EZTVx.to].mkv.torrent" length="258980867" type="application/x-bittorrent"/>
</item>

If I use the enclosure URL , it will download the .torrent file which is not what I am looking for as there will be an extra step. But I will try it
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
somebody has to perform it. it's not native with http. chrome performs an extra step to make it look like it's handling it itself. okhttp speaks for itself; it's an http client. magnet is not an http protocol.
 
Upvote 0
Top