|
@@ -1,31 +1,25 @@
|
|
|
package com.tzld.piaoquan.longarticle.utils.other;
|
|
|
|
|
|
-import cn.hutool.http.HttpUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.tzld.piaoquan.longarticle.utils.ConfigUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
-import org.apache.http.HttpResponse;
|
|
|
-import org.apache.http.client.methods.HttpGet;
|
|
|
-import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
-import org.apache.http.impl.client.HttpClients;
|
|
|
-import org.apache.http.message.BasicHeader;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.io.*;
|
|
|
+import java.io.File;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.io.OutputStream;
|
|
|
import java.net.*;
|
|
|
import java.nio.file.Files;
|
|
|
import java.util.Objects;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
+import static com.tzld.piaoquan.longarticle.common.constants.ProxyConstant.*;
|
|
|
+
|
|
|
@Slf4j
|
|
|
public class VideoDownloader {
|
|
|
|
|
|
- private static final String PROXY_HOST = "q796.kdltps.com";
|
|
|
- private static final int PROXY_PORT = 15818;
|
|
|
- private static final String USERNAME = "t17772369458618";
|
|
|
- private static final String PASSWORD = "5zqcjkmy";
|
|
|
private static final int MAX_RETRIES = 3;
|
|
|
|
|
|
public static String downloadCover(String outVideoId, String platform, String coverUrl) {
|
|
@@ -146,7 +140,7 @@ public class VideoDownloader {
|
|
|
new Authenticator() {
|
|
|
public PasswordAuthentication getPasswordAuthentication() {
|
|
|
return new PasswordAuthentication(
|
|
|
- "t17772369458618", "5zqcjkmy".toCharArray());
|
|
|
+ USERNAME, PASSWORD.toCharArray());
|
|
|
}
|
|
|
}
|
|
|
);
|