ソースを参照

增加超时时间

xueyiming 5 ヶ月 前
コミット
98c05f9235

+ 4 - 4
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CrawlerVideoServiceImpl.java

@@ -36,7 +36,7 @@ public class CrawlerVideoServiceImpl {
 
     private static final String default_user_id = "69637498";
 
-    private static final Double NLP_SIMILARITY_THRESHOLD = 0.45;
+    private static final Double NLP_SIMILARITY_THRESHOLD = 0.55;
 
     private static final int MAX_NUM = 3;
 
@@ -141,7 +141,7 @@ public class CrawlerVideoServiceImpl {
         CrawlerVideoExample example = new CrawlerVideoExample();
         example.createCriteria().andContentIdEqualTo(contentId);
         long l = crawlerVideoMapper.countByExample(example);
-        return l >= MAX_NUM;
+        return l >= MIN_NUM;
     }
 
 
@@ -302,7 +302,7 @@ public class CrawlerVideoServiceImpl {
                 if (StringUtils.isNotEmpty(videoOssPath)) {
                     CrawlerVideo udpateCrawlerVideo = new CrawlerVideo();
                     udpateCrawlerVideo.setVideoOssPath(videoOssPath);
-                    if(StringUtils.isNotEmpty(coverPath)){
+                    if (StringUtils.isNotEmpty(coverPath)) {
                         String coverOssPath = OSSUploader.uploadToOSS(coverPath, "image");
                         udpateCrawlerVideo.setCoverOssPath(coverOssPath);
                     }
@@ -328,7 +328,7 @@ public class CrawlerVideoServiceImpl {
                 return true;
             }
         }
-        return false;
+        return count >= MIN_NUM;
     }
 
 }

+ 2 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/DouyinSearch.java

@@ -52,6 +52,7 @@ public class DouyinSearch {
         HttpResponse response = HttpRequest.post(url)
                 .header("Content-Type", "application/json")
                 .body(payload.toString())
+                .timeout(60000) // 设置超时时间
                 .execute();
 
         List<JSONObject> resultList = new ArrayList<>();
@@ -91,6 +92,7 @@ public class DouyinSearch {
         HttpResponse response = HttpRequest.post(url)
                 .header("Content-Type", "application/json")
                 .body(payload.toString())
+                .timeout(60000) // 设置超时时间
                 .execute();
 
         JSONObject videoInfo = JSONObject.parseObject(response.body()).getJSONObject("data").getJSONObject("data");

+ 1 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/HkspSearch.java

@@ -156,6 +156,7 @@ public class HkspSearch {
                 .header("Content-Type", "application/x-www-form-urlencoded")
                 .header("Referer", "https://haokan.baidu.com")
                 .header("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")
+                .timeout(120000) // 设置超时时间
                 .form(params)
                 .setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("l901.kdltps.com", 15818)))
                 .execute();