java获取 Response 中的 location属性-【抖音-douyin】
需求:如图:得到页面上的location的值代码实现ps:参考:https://www.cnblogs.com/zhougaojun/p/4547160.htmlhttps://www.cnblogs.com/niss/p/3711901.htmlJsoup的实现public String json() throws IOException {&n
需求:

如图:得到 页面上的 location 的值
代码实现
插播一条
下面这个公众号是凯哥开发的,福利号:外卖、买菜、电商领Q的

怎么领券?

ps:参考: https://www.cnblogs.com/zhougaojun/p/4547160.html
https://www.cnblogs.com/niss/p/3711901.html
Jsoup 的实现
public String json() throws IOException {
Response execute = Jsoup.connect("https://www.freepik.com/download-file/1088379")
.followRedirects(false)
.method(Method.GET)
.execute();
return execute.headers("location").get(0);
}旧版httpclient
private String getMaxUrl(String img_downloard_url) {
String locale ="";
//创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpParams params = httpClient.getParams();
params.setParameter(ClientPNames.HANDLE_REDIRECTS, false);
//创建httpGet对象,设置url地址:
HttpGet httpGet = new HttpGet(img_downloard_url);
CloseableHttpResponse response= null;
try {
//使用httpClient发起请求 获取 response
response = httpClient.execute(httpG原创不易,完成人机校验,阅读全文