Open albtronics opened 2 years ago
1337x.wtf is no longer accessible. If you go to the site from a web browser, it gives a nginx page and curling the site won't give your search results. Right now, I am using ricky-aufvaa's script that he sent in one of the pull requests which uses The Pirate Bay rather than 1337x.
The script (Credits to #85)
#!/bin/sh
name=$(printf '%s' "$*" | sed 's/ /\%20/g')
curl -s -o url.html https://thepiratebay.party/search/$name/1/99/200
magnet=$(cat url.html|grep -E 'magnet\:\?'|sed 's/href\=/ /g'|awk '{print $2}'|sed 's/"/ /g'| head -n 1|sed 's/ //g')
peerflix -l -k $magnet
I was about to open a new issue but I came accross yours, so I comment here. All 6 of the site's official domains are now under cloudflare protection, which means that curl now scrapes the "verify you are human" page that shows up before entering each domain. This makes the search fail, so the movie parameter is wrong, which makes the magnet parameter fail too, so peerflix at the end has no magnet link to use and pops up that error.
Behold the lamest patch ever! Changing 1337x to its copycat, 1377x, makes the script work again because the second one has no cloudflare protection. Full script
#!/bin/sh
query=$(printf '%s' "$*" | tr ' ' '+' )
movie=$(curl -s https://www.1377x.to/search/$query/1/ | grep -Eo "torrent\/[0-9]{7}\/[a-zA-Z0-9?%-]*/" | head -n 1)
magnet=$(curl -s https://www.1377x.to/$movie | grep -Po "magnet:\?xt=urn:btih:[a-zA-Z0-9]*" | head -n 1)
peerflix -l -k $magnet
Proof that it works, by using the -x parameter to run it and an echo at the end instead of peeflix, just to prove that the magnet link is what peerflix actually gets
$ bash -x notflix deadpool
++ printf %s deadpool
++ tr ' ' +
+ query=deadpool
++ curl -s https://www.1377x.to/search/deadpool/1/
++ grep -Eo 'torrent\/[0-9]{7}\/[a-zA-Z0-9?%-]*/'
++ head -n 1
+ movie=torrent/3162062/Deadpool-2-2018-WEBRip-720p-YTS-YIFY/
++ curl -s https://www.1377x.to/torrent/3162062/Deadpool-2-2018-WEBRip-720p-YTS-YIFY/
++ grep -Po 'magnet:\?xt=urn:btih:[a-zA-Z0-9]*'
++ head -n 1
+ magnet='magnet:?xt=urn:btih:00102086B401F8CE049BE55410FF9C69D87BB740'
+ echo 'magnet:?xt=urn:btih:00102086B401F8CE049BE55410FF9C69D87BB740'
magnet:?xt=urn:btih:00102086B401F8CE049BE55410FF9C69D87BB740
The main domain of 1337x no longer pops that cloudflade verification/protection, so the script works with it again and the above patch is redundant. Proof
$ bash -x notflix deadpool
++ printf %s deadpool
++ tr ' ' +
+ query=deadpool
++ curl -s https://www.1337x.to/search/deadpool/1/
++ grep -Eo 'torrent\/[0-9]{7}\/[a-zA-Z0-9?%-]*/'
++ head -n 1
+ movie=torrent/3163584/Deadpool-2-2018-BluRay-1080p-YTS-YIFY/
++ curl -s https://www.1337x.to/torrent/3163584/Deadpool-2-2018-BluRay-1080p-YTS-YIFY/
++ grep -Po 'magnet:\?xt=urn:btih:[a-zA-Z0-9]*'
++ head -n 1
+ magnet='magnet:?xt=urn:btih:E774B886539A3F7EBF1FFE7CD01A107F73298248'
+ echo 'magnet:?xt=urn:btih:E774B886539A3F7EBF1FFE7CD01A107F73298248'
magnet:?xt=urn:btih:E774B886539A3F7EBF1FFE7CD01A107F73298248
The other 5 official domains of 1337x still have that cloudflare verification/protection.
Usage: /usr/bin/node /usr/local/bin/peerflix magnet-link-or-torrent [options]