LivingWithHippos / unchained-android

App to interact with real-debrid API
GNU General Public License v3.0
380 stars 51 forks source link

[Plug-in development] bt4g.org #191

Closed morpheasgr closed 1 month ago

morpheasgr commented 2 years ago

Greetings and salutations, after creating my first search plugin successfully (thanks to your help), I wanted to try making another one.

I think like I am getting the hang of it.

The site I am interested in is https://bt4g.org

I have my doubts that I will succeed because the site uses Cloudflare so it might be impossible for now.

In case that is no issue, I went ahead and took a look at how the site works. It doesn't have any direct magnet links , neither on the search results page or on the details page, it is paginated, has sorting (which I would like to take advantage of) and categories, but the details url it links to on each result is basically https://bt4g.org/magnet/INFOHASH, which is more or less all we need to construct a magnet URI by some method like append_url or append_other, if that's what they exist for. I don't know how these work yet.

When going to the details page the magnet button leads to

https://downloadtorrentfile.com/hash/INFOHASH?name=<a name (optional)>

And all that linked site (which also displays an html page sadly, it does not spit back the magnet URI directly and does not seem to have an API) does is turn the INFOHASH into a magnet URI followed by (always the same AFAIK) long list of trackers, it simply shows an "Open" and a "Copy" button for the magnet URI. The conversion it does is as follows:

magnet:?xt=urn:INFOHASH&dn=<the name if we passed one> &tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://9.rarbg.com:2810/announce&tr=udp://tracker.openbittorrent.com:6969/announce&tr=http://openbittorrent.com:80/announce&tr=udp://www.torrent.eu.org:451/announce&tr=udp://tracker.torrent.eu.org:451/announce&tr=udp://tracker.tiny-vps.com:6969/announce&tr=udp://tracker.pomf.se:80/announce&tr=udp://tracker.moeking.me:6969/announce&tr=udp://tracker.lelux.fi:6969/announce&tr=udp://tracker.dler.org:6969/announce&tr=udp://tracker-udp.gbitt.info:80/announce&tr=udp://retracker.netbynet.ru:2710/announce&tr=udp://retracker.lanta-net.ru:2710/announce&tr=udp://opentracker.i2p.rocks:6969/announce&tr=udp://opentor.org:2710/announce&tr=udp://open.stealth.si:80/announce&tr=udp://explodie.org:6969/announce&tr=udp://exodus.desync.com:6969/announce&tr=udp://bt2.archive.org:6969/announce&tr=http://tracker.bt4g.com:2095/announce

So I was thinking we could skip diving into each result or using that downloadtorrentfile.com site at all and just construct the magnet URI from the https://bt4g.org/magnet/INFOHASH in the results page by extracting just the infohash through some RegEx and adding the prefix magnet:?xt=urn: to it, perhaps even the long list of trackers as a suffix , if possible.

Excuse me for the wall of text, I am just thinking out loud as to how I should proceed. If there will be issues due to cloudflare, this is just a brainfart anyway hahah.

Thanks for taking the time to read through this, I hope I'm gonna be able to create that plugin.

LivingWithHippos commented 2 years ago

I made the plugin but yes, it is being blocked by cloudflare, so it won't work

LivingWithHippos commented 2 years ago

bt4gorg.txt

plugin sample

LivingWithHippos commented 1 month ago

done