grep -Po "magnet:\?xt=urn:btih:[a-zA-Z0-9]*"
truncates the magnet at the first ampersand.
Maybe try:
magnet=$(grep -Po "magnet:\?xt=urn:btih:[[:alnum:][:punct:]]*" $cachedir/tmp.html | head -n 1)
deluge=$(echo "$magnet" | tr -d \")
deluge-console add "$deluge"
grep -Po "magnet:\?xt=urn:btih:[a-zA-Z0-9]*"truncates the magnet at the first ampersand.
Maybe try:
magnet=$(grep -Po "magnet:\?xt=urn:btih:[[:alnum:][:punct:]]*" $cachedir/tmp.html | head -n 1)deluge=$(echo "$magnet" | tr -d \")deluge-console add "$deluge"