简体   繁体   中英

Jsoup html parse region language settings java

How can I parse HTML data like I were in other country?

I've tried to use proxy (code):

System.setProperty("http.proxyHost", "some proxy");
System.setProperty("http.proxyPort", "some port");

but it doesn't work properly. I still get data in my country language.

I've also tried using VPN, but when I do my program (Jsoup parser) doesn't download anything.

EDIT:

Thanks for your time, the marked answer helped me to solve the problem. The complete solution I found there .

That depends on the site you're trying to download. If the site is using IP geolocation, the only solution is to use appropiate proxy: https://stackoverflow.com/a/1433296/1608594

If the site is only using HTTP headers to determine language, you can send Accept-Language , Accept-Charset and Accept-Encoding headers with the proper values. https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM