zhangyong 4 months ago
parent
commit
c3af04032a

+ 7 - 0
etl-core/src/main/java/com/tzld/crawler/etl/service/impl/EtlServiceImpl.java

@@ -458,6 +458,13 @@ public class EtlServiceImpl implements EtlService {
                                         , !CollectionUtils.isEmpty(proxyPlatform) && proxyPlatform.contains(platfrm),
                                         proxyInfo);
                             }
+                            // 祝福好运多
+                            else if (platform.equals("zhufuhaoyunduo")) {
+                                FileUtils.downloadZFHYD(fileUrl, fpath,
+                                        !CollectionUtils.isEmpty(randomUaPlatform) && randomUaPlatform.contains(platfrm)
+                                        , !CollectionUtils.isEmpty(proxyPlatform) && proxyPlatform.contains(platfrm),
+                                        proxyInfo);
+                            }
                             else {
                                 String tempUrl = fileUrl;
                                 if (platform.equals("zhufuzhonglaonianrenruyijixiang")) {

+ 13 - 0
etl-core/src/main/java/com/tzld/crawler/etl/util/FileUtils.java

@@ -211,6 +211,19 @@ public class FileUtils {
         log.info("downloaded successfully [{}] to [{}]", fileUrl, filePath);
     }
 
+
+    public static void downloadZFHYD(String fileUrl, String filePath, boolean useUa, boolean useProxy, Map<String, String> proxyInfo) throws Exception {
+        log.info("begin download [{}] to [{}] useUa [{}] useProxy [{}] proxyInfo[{}]", fileUrl, filePath, useUa, useProxy, proxyInfo);
+        String command = String.format("ffmpeg -y -i \"%s\" -c copy -bsf:a aac_adtstoasc \"%s\"", fileUrl, filePath);
+        Process process = Runtime.getRuntime().exec(command);
+        int exitCode = process.waitFor();
+        if (exitCode == 0) {
+            log.info("Downloaded successfully [{}] to [{}]", fileUrl, filePath);
+        } else {
+            throw new IOException("FFmpeg download failed with exit code " + exitCode);
+        }
+    }
+
     public static void downloadDY(String fileUrl, String filePath, boolean useUa, boolean useProxy, Map<String, String> proxyInfo) throws Exception {
         log.info("begin download [{}] to [{}] useUa [{}] useProxy [{}] proxyInfo[{}]", fileUrl, filePath, useUa, useProxy, proxyInfo);
         URL url = new URL(fileUrl);