|
@@ -32,7 +32,7 @@ public class DownloadUtils {
|
|
URL url = new URL(urlStr + "?" + postBody);
|
|
URL url = new URL(urlStr + "?" + postBody);
|
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
//设置超时间为3秒
|
|
//设置超时间为3秒
|
|
- conn.setConnectTimeout(10 * 1000);
|
|
|
|
|
|
+ conn.setConnectTimeout(120 * 1000);
|
|
//防止屏蔽程序抓取而返回403错误
|
|
//防止屏蔽程序抓取而返回403错误
|
|
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
|
|
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
|
|
conn.setRequestProperty("Access-Token", token);
|
|
conn.setRequestProperty("Access-Token", token);
|
|
@@ -45,7 +45,6 @@ public class DownloadUtils {
|
|
byte[] getData = readInputStream(inputStream);
|
|
byte[] getData = readInputStream(inputStream);
|
|
|
|
|
|
//文件保存位置
|
|
//文件保存位置
|
|
- System.err.println(downloadPath);
|
|
|
|
File saveDir = new File(downloadPath);
|
|
File saveDir = new File(downloadPath);
|
|
if (!saveDir.exists()) {
|
|
if (!saveDir.exists()) {
|
|
saveDir.mkdirs();
|
|
saveDir.mkdirs();
|