Change the default USER-AGENT and REFERRER value in wget

这一生的挚爱 提交于 2020-03-23 05:40:19

问题


When using wget on the console, I usually want to download the version, my Firefox would get, for ex.

 wget  --header="Accept: text/html" --user-agent="Mozilla/5.0 ..." --referrer connect.wso2.com http://dist.wso2.org/products/carbon/4.2.0/wso2carbon-4.2.0.zip

How can I change the default behaviour of wget, so just using wget would use the actual useragent and header my current Firefox is using? (Also adding the base-URL of the downloaded site as referer would be nice)


回答1:


Create an alias like so:

alias wget='wget --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" --referrer connect.wso2.com'

You can use type to show how your new wget alias will be interpreted when used as a command name.

type wget
wget is aliased to `wget --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" --referrer connect.wso2.com'


来源:https://stackoverflow.com/questions/32500128/change-the-default-user-agent-and-referrer-value-in-wget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!