Browse Source

huoshan cdn handle

丁云鹏 1 năm trước cách đây
mục cha
commit
5699a8eff8

+ 5 - 1
etl-core/src/main/java/com/tzld/crawler/etl/service/impl/EtlServiceImpl.java

@@ -423,7 +423,11 @@ public class EtlServiceImpl implements EtlService {
                                         , !CollectionUtils.isEmpty(proxyPlatform) && proxyPlatform.contains(platfrm),
                                         proxyInfo);
                             } else {
-                                FileUtils.download(fileUrl, fpath,
+                                String tempUrl = fileUrl;
+                                if (platform.equals("zhufuzhonglaonianrenruyijixiang")) {
+                                    tempUrl = tempUrl.replace("https://api-hl.huoshan.com", "http://api-hl.huoshan.com");
+                                }
+                                FileUtils.download(tempUrl, fpath,
                                         !CollectionUtils.isEmpty(randomUaPlatform) && randomUaPlatform.contains(platfrm)
                                         , !CollectionUtils.isEmpty(proxyPlatform) && proxyPlatform.contains(platfrm),
                                         proxyInfo);

+ 3 - 2
etl-core/src/main/java/com/tzld/crawler/etl/util/FileUtils.java

@@ -90,7 +90,7 @@ public class FileUtils {
     }
 
     public static void download(String fileUrl, String filePath, boolean useUa) throws Exception {
-        downloadForGZH(fileUrl, filePath, useUa, false, null);
+        download(fileUrl, filePath, useUa, false, null);
     }
 
     public static void download(String fileUrl, String filePath, boolean useUa, boolean useProxy, Map<String, String> proxyInfo) throws Exception {
@@ -194,7 +194,8 @@ public class FileUtils {
 
     public static void main(String[] args) throws Exception {
         // try {
-        download("https://mpvideo.qpic.cn/0bc3tuacuaaataaeceuifbrvbhodfkoqakqa.f10004.mp4?dis_k=dd10b558d25ce61609d74e0bbce16511&dis_t=1696852869&play_scene=10120&auth_info=SoLXgsJxHz1WiLfcsFknajhsMkhsN0djSkl6ZA1TQSRsM1doU31CUjRgMRMReDBQMg==&auth_key=c898b13e9980e164e21174ab60c10e0e&vid=wxv_2689260325199855618&format_id=10004&support_redirect=0&mmversion=false", "/Users/dingyunpeng/Downloads/" + System.currentTimeMillis(), true);
+        System.out.println("https://api-hl.huoshan.com/hotsoon/item/video/_source/?video_id=v0300fg10000ckmbrbbc77uc3nq19840&line=0&app_id=0&vquality=normal&watermark=0&long_video=0&sf=4&ts=1697528496&item_id=7290410334844718376".replace("https://api-hl.huoshan.com", "http://api-hl.huoshan.com"));
+        download("http://api-hl.huoshan.com/hotsoon/item/video/_source/?video_id=v0d00fg10000ckjb1bbc77u340cpgelg&line=0&app_id=0&vquality=normal&watermark=0&long_video=0&sf=4&ts=1697529427&item_id=7288707446217002255", "/Users/dingyunpeng/Downloads/" + System.currentTimeMillis(), true);
         //
         // } catch (Exception e) {
         //     e.printStackTrace();