Skip to content

Conversation

@ricky-aufvaa
Copy link

This uses less lines of code(less than 4 hahah) and also uses the pirate bay.

Copy link

@thamognya thamognya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is overall a better idea to use the pirate bay over 1337x.wtf. Just remove the tab from magnet=$(cat url.html|grep -E 'magnet\:\?'|sed 's/href\=/ /g'|awk '{print $2}'|sed 's/"/ /g'| head -n 1|sed 's/ //g') line and it is perfect.

Copy link

@thamognya thamognya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ricky-aufvaa
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants