blob: 9f7d006b8433adf7a7efe1c3922d2d14beb4284c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/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"
|