I want to know what default user agent is passed if I use wget from command line without specifying explicit user agent.
I have some code which cahnges output based on user agent .
wget http://www.google.com -O test.html
“User-Agent” is a header field that the browser sends to the server it wants to access. Therefore, to download from a server that is refusing to connect, try to modify the user agent. Find a database of all user agents online, search for the one you need and run the command: wget --user-agent="User Agent Here" "[URL]"
Wget is a networking command-line tool that lets you download files and interact with REST APIs. It supports the HTTP , HTTPS , FTP , and FTPS internet protocols. Wget can deal with unstable and slow network connections. In the event of a download failure, Wget keeps trying until the entire file has been retrieved.
"wget -d" will show the request made to the server.
$ wget -d http://www.google.com -O/dev/null 2>&1 |grep ^User-Agent
User-Agent: Wget/1.13.4 (linux-gnu)
User-Agent: Wget/1.13.4 (linux-gnu)
User-Agent: Wget/1.13.4 (linux-gnu)
At your shell prompt, do:
> man wget
scroll down to -U agent-string
, which states:
"Wget normally identifies as Wget/version, version being the current version number of Wget".
So do:
> wget --version
which will give you the version, and thus your user-agent.
Incidently, you may find that some sites block wget, so depending on what you're doing you may need to change this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With