diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-02-14 02:23:53 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-02-14 02:23:53 +0100 |
commit | f5526c4cfbe0803212050dc53a487e5c3b38bd4b (patch) | |
tree | 2ba0b97fbd1a6ac4f3ae4b529da0d21570a3f4b8 /bin/extra/magnet2torrent | |
parent | 991fc41022fbdf7da399eb8ea53b3c67d0239d47 (diff) |
Update scripts
Diffstat (limited to 'bin/extra/magnet2torrent')
-rwxr-xr-x | bin/extra/magnet2torrent | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/extra/magnet2torrent b/bin/extra/magnet2torrent new file mode 100755 index 0000000..0a1f83e --- /dev/null +++ b/bin/extra/magnet2torrent @@ -0,0 +1,27 @@ +#!/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%%&*}" + +# Download the torrent file from a torrent website +torrent_file="${hash}.torrent" +wget "https://itorrents.org/torrent/${hash}.torrent" -O "$torrent_file" +echo "Torrent file written to ${torrent_file}" |