pirokit icon indicating copy to clipboard operation
pirokit copied to clipboard

magnet truncated

Open cpnfeeny opened this issue 3 years ago • 4 comments

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"

cpnfeeny avatar Jan 03 '21 17:01 cpnfeeny

is that a issue or a enhancement idea?

Bugswriter avatar Jan 03 '21 18:01 Bugswriter

It's an issue. The grep command as it is doesn't produce the entire magnet link. It's truncating the magnet link at the first ampersand / non alpha that appears.

So the script doesn't actually work. Or, at least it didn't for me.

What I posted above will get the whole magnet link, but it also includes the closing " character of the magnet. So I used tr to remove that before passing it to deluge.

I edited mine to pass the link to my clipboard, but I think the above should work how you wanted.

cpnfeeny avatar Jan 03 '21 18:01 cpnfeeny

Cool script, by the way!

cpnfeeny avatar Jan 03 '21 18:01 cpnfeeny

Yeah I got it. I only used info hash to start downloading. You should remove code to start downloading and just try to paste magnet link. Try downloading something with good number of seeders. I will add regex which grep magnet link with trackers and not just hash.

Bugswriter avatar Jan 04 '21 04:01 Bugswriter