|
@@ -80,6 +80,9 @@ public class VideoDownloader {
|
|
}
|
|
}
|
|
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXY_HOST, PROXY_PORT));
|
|
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXY_HOST, PROXY_PORT));
|
|
HttpURLConnection connection = (HttpURLConnection) new URL(videoUrl).openConnection(proxy);
|
|
HttpURLConnection connection = (HttpURLConnection) new URL(videoUrl).openConnection(proxy);
|
|
|
|
+ connection.setConnectTimeout(10000);
|
|
|
|
+ // 设置读取超时时间(单位:毫秒)
|
|
|
|
+ connection.setReadTimeout(60000);
|
|
connection.setRequestMethod("GET");
|
|
connection.setRequestMethod("GET");
|
|
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0");
|
|
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0");
|
|
connection.setRequestProperty("Accept", "*/*");
|
|
connection.setRequestProperty("Accept", "*/*");
|