tujidelv 2 سال پیش
والد
کامیت
07cfb60872

+ 1 - 1
src/main/java/top/lvzhiqiang/mapper/CrawlerLoveFootMapper.java

@@ -72,7 +72,7 @@ public interface CrawlerLoveFootMapper {
             "         WHERE cast is not null and cast != ''" +
             "         WHERE cast is not null and cast != ''" +
             "     ) M " +
             "     ) M " +
             "GROUP BY M.cast " +
             "GROUP BY M.cast " +
-            "ORDER BY COUNT(M.cast) DESC LIMIT 80")
+            "ORDER BY COUNT(M.cast) DESC LIMIT 60")
     List<VideoCast> findCast();
     List<VideoCast> findCast();
 
 
     /**
     /**

+ 10 - 1
src/main/java/top/lvzhiqiang/service/impl/BgServiceImpl.java

@@ -2,6 +2,7 @@ package top.lvzhiqiang.service.impl;
 
 
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Connection;
 import org.jsoup.Connection;
+import org.jsoup.HttpStatusException;
 import org.jsoup.Jsoup;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Element;
@@ -1164,7 +1165,15 @@ public class BgServiceImpl implements BgService {
                         sampleBoxHref = sampleBoxEle.attr("abs:href");
                         sampleBoxHref = sampleBoxEle.attr("abs:href");
                     }
                     }
 
 
-                    responseImg = Jsoup.connect(sampleBoxHref).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
+                    try {
+                        responseImg = Jsoup.connect(sampleBoxHref).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
+                    } catch (HttpStatusException e) {
+                        sampleBoxHref = sampleBoxEle.select("img").attr("src");
+                        if (!sampleBoxHref.contains("http")) {
+                            sampleBoxHref = sampleBoxEle.select("img").attr("abs:src");
+                        }
+                        responseImg = Jsoup.connect(sampleBoxHref).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
+                    }
                     String sampleBoxFileName = sampleBoxHref.substring(sampleBoxHref.lastIndexOf("/") + 1);
                     String sampleBoxFileName = sampleBoxHref.substring(sampleBoxHref.lastIndexOf("/") + 1);
                     saveFile2(responseImg.bodyStream(), qibingPath.concat(qibingImgGF), sampleBoxFileName);
                     saveFile2(responseImg.bodyStream(), qibingPath.concat(qibingImgGF), sampleBoxFileName);
                 }
                 }