#!/bin/sh ################################# # # # Bash script to convert a # # magnet link to a torrent file # # # # StrickStuff.com # # # ################################# # Check that the user entered a valid magnet link if [ "$#" -ne 1 ] || [ "${1##*magnet*}" ] then echo "Usage: $0 " exit 1 fi # Extract the info hash from the magnet link hash="${1##*btih:}" hash="${hash%%&*}" url="$(curl -s "https://torrage.info/torrent.php?h=$hash" | pup '#torrent-operation-link attr{href}')" >&2 printf "url: %s\n" "$url" # Download the torrent file from a torrent website torrent_file="${hash}.torrent" curl "$url" -H 'Referer: https://torrage.info/' > tmp.torrent echo "$torrent_file"