Open ricky-aufvaa opened 2 years ago
Take this as an example which uses lesser lines and does not require to download url.html which is not required and can be replaced with a variable.
#!/bin/bash QUERY=$(printf '%s' "$*" | sed 's/ /\%20/g') MAGNET=$(curl -s "https://thepiratebay.party/search/$QUERY/1/99/0" -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' | grep -Eo "magnet\:\?[a-zA-Z0-9]{2}=[a-zA-Z0-9]{3}:[a-zA-Z0-9]{4}:[a-zA-Z0-9?%-' '=.+;-]*"| head -n 1) peerflix -l -k $MAGNET
Thank you! This is very useful. I understand that my script is very redundant. Since it's the first script I've written.
This uses less lines of code(less than 4 hahah) and also uses the pirate bay.