Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  20] [ 0]  / answers: 1 / hits: 20241  / 2 Years ago, wed, may 11, 2022, 2:38:54

I have a URL like this:



http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar


I want to download this URL using wget. If I pass it directly to wget, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded version of the URL above to wget, it throws the following error:



$ wget "http%3A%2F%2Fdl.minitoons.ir%2Flongs%2FKhumba%20(2013)%20%5BEN%5D%20%5BBR-Rip%20720p%5D%20-%20%5Bwww.minitoons.ir%5D.rar"
wget: unable to resolve host address `http://dl.minitoons.ir/longs/khumba (2013) [en] [br-rip 720p] - [www.minitoons.ir].rar'


Notice that wget changed the casing of URL (for example Khumba to khumba). What should I do to solve this problem?


More From » wget

 Answers
1

As this is annoyingly so common, there are various converters available - e.g. this site. You can use these to decode the URL - so it will convert this:


http%3A%2F%2Fdl.minitoons.ir%2Flongs%2FKhumba%20(2013)%20%5BEN%5D%20%5BBR-Rip%20720p%5D%20-%20%5Bwww.minitoons.ir%5D.rar

to:


http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar

It would be niCe to have a command line version though...


EDIT:


Found a command line version - basically:


echo "http%3A%2F%2F-REST-OF-URL" | sed -e's/%([0-9A-F][0-9A-F])/x1/g' | xargs echo -e

This can be implemented in a script like this to decode the URL:


#!/bin/bash
echo "$@" | sed -e's/%([0-9A-F][0-9A-F])/x1/g' | xargs echo -e
exit

which if saved and made executable, works quite nicely.


also this script, which will download the UL as well:


#!/bin/bash
echo "$@" | sed -e's/%([0-9A-F][0-9A-F])/x1/g' | xargs echo -e | wget -c -i -
exit

N.B. I think the case the URL is in is not important for most sites - e.g. HTTP://WWW.UBUNTU.COM


[#26723] Friday, May 13, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
heathree

Total Points: 157
Total Questions: 132
Total Answers: 108

Location: Honduras
Member since Mon, Apr 5, 2021
3 Years ago
;