|
|
@@ -1,6 +1,7 @@
|
|
|
package com.kawayi.app;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
@@ -37,7 +38,7 @@ public class WalkApp {
|
|
|
private static void parsePhoto() {
|
|
|
final String secretKey = "kexikehe";
|
|
|
|
|
|
- File photoDir = new File("F:\\kawayi\\image\\");
|
|
|
+ File photoDir = new File("F:\\kawayi\\photo\\");
|
|
|
if (!photoDir.exists()) {
|
|
|
photoDir.mkdirs();
|
|
|
}
|
|
|
@@ -122,7 +123,8 @@ public class WalkApp {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- HttpUtil.downloadFile(url, videoFile);
|
|
|
+ HttpUtil.downloadFile(url, videoFile, 30000);
|
|
|
+ savePath(url);
|
|
|
mNum++;
|
|
|
System.out.println("下载了一个文件,共:" + mNum + "个");
|
|
|
} catch (Exception e) {
|
|
|
@@ -138,4 +140,14 @@ public class WalkApp {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private static void savePath(String url) {
|
|
|
+ if (url.endsWith("mp4")) {
|
|
|
+ File videoUrlFile = new File("F:\\kawayi\\video.txt");
|
|
|
+ FileUtil.appendUtf8String(url+"\n", videoUrlFile);
|
|
|
+ } else {
|
|
|
+ File photoUrlFile = new File("F:\\kawayi\\photo.txt");
|
|
|
+ FileUtil.appendUtf8String(url+"\n", photoUrlFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|