When you run this command:
wget https://translate.google.hu/?hl=hu&tab=wT#en/hu/Enthusiast
what really happens is:
- you run
wget
with URL of "https://translate.google.hu/?hl=hu";
- ampersand means that
wget
will run in background;
- a variable named
tab
is defined and gets a value wT#en/hu/Enthusiast
.
The reason for all this is that shell reserves some characters, ampersand included, for special things. To prevent shell from interpreting ampersand, use quotes:
wget 'https://translate.google.hu/?hl=hu&tab=wT#en/hu/Enthusiast'
With that resolved, you're still getting "Forbidden" response.
It's a race between clients who want to bypass the interface and the providers who don't want to let them. Google gets its revenue from ads, and it knows that your script won't display any. Thus, they're taking measures to forbid any access but via browser.
The only people who can tell you precisely why you have been "Forbidden" are Google engineers. That said, the easier of the techniques are well-known.
One of the easiest ones are blocking by "user agent string". This is a string identifying the make and version of the client (your browser or wget). It looks like this:
Wget/1.16.3 (linux-gnu)
The client sends this string with every request. The server can use it to tweak the appearance of the result, or to deny access, like in your case.
wget
accepts --user-agent
flag where you can specify the user agent string to send. To imitate your own browser, you can type "what is my user agent" into that same Google and copy the string from there :) Then, just pass it to wget
like so:
wget --user-agent='Mozilla/5.0 (Windows NT 6.3; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0' \
'https://translate.google.hu/?hl=hu&tab=wT#en/hu/Enthusiast'
Best Answer
It seems to be caused by a bug in
wget
that makes it fail on long URLs, or on writing to file names it had derived from long ursl.See wget starts downloading then stops “cannot write to”
This but looks related, for example: bug #21714: File name too long
The problem may be solved already in the current version of
wget
- let us know the version you use if it still exists.