java JSOUP 中的用户代理?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10187603/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
UserAgent in JSOUP?
提问by Thinker
I have always seen everywhere in JSOUP
code.
我总是在JSOUP
代码中随处可见。
Useragent
is set to Mozilla .
Useragent
设置为 Mozilla 。
What if i want to set it to google chrome or opera?
如果我想将它设置为谷歌浏览器或歌剧怎么办?
Jsoup.connect(url)
.userAgent("Mozilla");
How i can achieve this? Thanks in advance.
我怎么能做到这一点?提前致谢。
回答by frno
go there :
去那里 :
http://www.useragentstring.com/pages/Opera/or http://www.useragentstring.com/pages/Chrome/
http://www.useragentstring.com/pages/Opera/或 http://www.useragentstring.com/pages/Chrome/
and get the one you like.
并得到你喜欢的那个。
for example:
例如:
Jsoup.connect(url).userAgent("Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52");