新增涩图
This commit is contained in:
@@ -3,6 +3,7 @@ package com.yutou.qqbot.utlis;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.qqbot.interfaces.DownloadInterface;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.Map;
|
||||
@@ -156,11 +157,16 @@ public class HttpTools {
|
||||
savePath.mkdirs();
|
||||
}
|
||||
Log.i("DOWNLOAD", "下载文件:" + url + " 保存文件:" + saveName);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
URLConnection connection;
|
||||
if(url.startsWith("https:")) {
|
||||
connection = (HttpsURLConnection) new URL(url).openConnection();
|
||||
}else{
|
||||
connection=(HttpURLConnection)new URL(url).openConnection();
|
||||
}
|
||||
|
||||
connection.addRequestProperty("User-Agent", getExtUa());
|
||||
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
|
||||
|
||||
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
jar = new File(donwloadPath + saveName + "_tmp.tmp");
|
||||
jar.createNewFile();
|
||||
|
||||
Reference in New Issue
Block a user