Selaa lähdekoodia

add:码池维度页面展示v1

tujidelv 3 vuotta sitten
vanhempi
commit
0e94927fa8

+ 7 - 5
src/main/java/top/lvzhiqiang/config/WebAppConfig.java

@@ -44,12 +44,14 @@ public class WebAppConfig implements WebMvcConfigurer {
 
         // 初始化字典码表
         dicCodeList = dicCodeMapper.findAll();
-        DicCode dicCode = dicCodeList.stream().filter(x -> 1 == x.getType() && "qibing_path".equals(x.getCodeKey())).findFirst().get();
-        String picPath = "F:/1/0/2/4/视频/电影/A级(成人级)/骑兵/";
-        if (dicCode != null) {
-            picPath = dicCode.getCodeValue();
+        DicCode dicCode4Qibing = dicCodeList.stream().filter(x -> 1 == x.getType() && "qibing_path".equals(x.getCodeKey())).findFirst().get();
+        DicCode dicCode4Machi = dicCodeList.stream().filter(x -> 1 == x.getType() && "machi_path".equals(x.getCodeKey())).findFirst().get();
+        String qibingPath = "F:/1/0/2/4/视频/电影/A级(成人级)/骑兵/";
+        if (dicCode4Qibing != null) {
+            qibingPath = dicCode4Qibing.getCodeValue();
         }
-        registry.addResourceHandler("/qibing/**").addResourceLocations("file:" + picPath);
+        registry.addResourceHandler("/qibing/**").addResourceLocations("file:" + qibingPath);
+        registry.addResourceHandler("/machi/**").addResourceLocations("file:" + dicCode4Machi.getCodeValue());
     }
 
     @Bean

+ 11 - 4
src/main/java/top/lvzhiqiang/controller/BgController.java

@@ -55,7 +55,7 @@ public class BgController {
      */
     @RequestMapping("/uploadFile4IdentificationCode")
     @ResponseBody
-    public R uploadFile4IdentificationCode(MultipartFile file) throws IOException {
+    public R uploadFile4IdentificationCode(MultipartFile file, Integer isDel) throws IOException {
         if (StringUtils.isEmpty(file.getOriginalFilename())) {
             throw new ParameterException("文件为空!");
         } else {
@@ -64,7 +64,11 @@ public class BgController {
             }
         }
 
-        bgService.uploadFile4IdentificationCode(file.getInputStream());
+        if (null == isDel) {
+            isDel = 1;
+        }
+
+        bgService.uploadFile4IdentificationCode(file.getInputStream(), isDel);
         return R.ok();
     }
 
@@ -76,12 +80,15 @@ public class BgController {
      */
     @RequestMapping("/jsoupIcodePool")
     @ResponseBody
-    public R jsoupIcodePool(Integer status) {
+    public R jsoupIcodePool(Integer status, Integer isDel) {
         if (null == status) {
             status = 1;
         }
+        if (null == isDel) {
+            isDel = 1;
+        }
 
-        bgService.jsoupIcodePool(status);
+        bgService.jsoupIcodePool(status, isDel);
         return R.ok();
     }
 }

+ 9 - 2
src/main/java/top/lvzhiqiang/controller/QueryHeaderController.java

@@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import top.lvzhiqiang.entity.VideoCast;
 import top.lvzhiqiang.entity.VideoGenres;
+import top.lvzhiqiang.mapper.VideoInfoPoolMapper;
 import top.lvzhiqiang.service.VideoCastService;
 import top.lvzhiqiang.service.VideoGenresService;
 
@@ -28,6 +29,9 @@ public class QueryHeaderController {
     @Resource
     private VideoGenresService videoGenresService;
 
+    @Resource
+    private VideoInfoPoolMapper videoInfoPoolMapper;
+
     @RequestMapping("/getQueryHeaderInfo")
     @ResponseBody
     public JSONObject getQueryHeaderInfo(String bigType) {
@@ -42,8 +46,11 @@ public class QueryHeaderController {
 
         } else if ("流出".equals(bigType)) {
 
-        } else if ("待处理".equals(bigType)) {
-
+        } else if ("码池".equals(bigType)) {
+            List<VideoCast> videoCastList = videoInfoPoolMapper.findCast();
+            List<VideoGenres> videoGenresList = videoInfoPoolMapper.findGenres();
+            result.put("videoCastList", videoCastList);
+            result.put("videoGenresList", videoGenresList);
         } else {
             List<VideoCast> videoCastList = videoCastService.findAll();
             List<VideoGenres> videoGenresList = videoGenresService.findAll();

+ 2 - 2
src/main/java/top/lvzhiqiang/mapper/IcodePoolMapper.java

@@ -19,7 +19,7 @@ public interface IcodePoolMapper {
     /**
      * 删除所有
      */
-    @Delete("DELETE FROM icode_pool")
+    @Delete("DELETE FROM icode_pool where 1=1")
     void deleteAll();
 
     /**
@@ -39,7 +39,7 @@ public interface IcodePoolMapper {
     /**
      * 根据状态查询识别码
      */
-    @Select("SELECT identification_code FROM icode_pool WHERE delete_flag = 1 and status = #{status}")
+    @Select("SELECT identification_code FROM icode_pool WHERE delete_flag = 1 and status = #{status} and retry_count <= 3")
     List<String> findIcodeByStatus(Integer status);
 
     /**

+ 21 - 0
src/main/java/top/lvzhiqiang/mapper/VideoInfoPoolMapper.java

@@ -3,9 +3,14 @@ package top.lvzhiqiang.mapper;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Options;
+import org.apache.ibatis.annotations.Select;
+import top.lvzhiqiang.entity.VideoCast;
+import top.lvzhiqiang.entity.VideoGenres;
+import top.lvzhiqiang.entity.VideoInfo;
 import top.lvzhiqiang.entity.VideoInfoPool;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 电影信息池Mapper
@@ -48,4 +53,20 @@ public interface VideoInfoPoolMapper {
     /**
      * 根据条件查询
      */
+    @Select("select '待审查' name union select '审查已通过' name union select '审查未通过' name")
+    List<VideoGenres> findGenres();
+
+    @Select("SELECT M.cast name " +
+            "FROM (" +
+            "         SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(vip.cast, ',', B.HELP_TOPIC_ID + 1), ',', - 1) AS cast" +
+            "         FROM video_info_pool vip" +
+            "                  JOIN MYSQL.HELP_TOPIC B" +
+            "                       ON B.HELP_TOPIC_ID < (LENGTH(vip.cast) - LENGTH(REPLACE(vip.cast, ',', '')) + 1)" +
+            "         WHERE genres != ''" +
+            "     ) M " +
+            "GROUP BY M.cast " +
+            "HAVING COUNT(M.cast) > 3")
+    List<VideoCast> findCast();
+
+    List<VideoInfo> getVideoInfoPoolList(Map<String, Object> params);
 }

+ 2 - 2
src/main/java/top/lvzhiqiang/service/BgService.java

@@ -21,12 +21,12 @@ public interface BgService {
      *
      * @param is
      */
-    void uploadFile4IdentificationCode(InputStream is);
+    void uploadFile4IdentificationCode(InputStream is, Integer isDel);
 
     /**
      * Jsoup IcodePool
      *
      * @param status
      */
-    void jsoupIcodePool(Integer status);
+    void jsoupIcodePool(Integer status, Integer isDel);
 }

+ 86 - 34
src/main/java/top/lvzhiqiang/service/impl/BgServiceImpl.java

@@ -20,14 +20,12 @@ import top.lvzhiqiang.util.StringUtils;
 
 import javax.annotation.Resource;
 import java.io.*;
+import java.net.Proxy;
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.ZoneOffset;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -87,7 +85,11 @@ public class BgServiceImpl implements BgService {
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     @Async
-    public void uploadFile4IdentificationCode(InputStream is) {
+    public void uploadFile4IdentificationCode(InputStream is, Integer isDel) {
+        if (isDel == 1) {
+            icodePoolMapper.deleteAll();
+        }
+
         List<String> uploadIcodeList = readFromIcodeStream(is);
         List<String> icodePoolList = icodePoolMapper.findIcode();
 
@@ -110,10 +112,14 @@ public class BgServiceImpl implements BgService {
      *
      * @param status
      */
-    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     @Async
     @Override
-    public void jsoupIcodePool(Integer status) {
+    public void jsoupIcodePool(Integer status, Integer isDel) {
+        if (isDel == 1) {
+            videoInfoPoolMapper.deleteAll();
+        }
+
+
         // 获取待抓取码列表
         List<String> icodePoolList = icodePoolMapper.findIcodeByStatus(status);
         // 获取主表所有识别码
@@ -124,13 +130,19 @@ public class BgServiceImpl implements BgService {
         if (dicCode == null) {
             return;
         }
-        String javbusUrl = dicCode.getCodeValue();
-        // 校验地址
-        try {
-            Jsoup.connect(javbusUrl.concat(javbusUrl));
-            log.info("jsoupIcodePool:javbus防屏蔽地址有效!javbusUrl={}", javbusUrl);
-        } catch (Exception e) {
-            log.error("jsoupIcodePool:javbus防屏蔽地址失效!javbusUrl={}", javbusUrl, e);
+        String[] javbusUrlArr = dicCode.getCodeValue().split(",");
+        List<String> javbusUrlList = new ArrayList<>();
+        for (String javbusUrl : javbusUrlArr) {
+            // 校验地址
+            try {
+                Jsoup.connect(javbusUrl.concat(javbusUrl));
+                log.info("jsoupIcodePool:javbus防屏蔽地址有效!javbusUrl={}", javbusUrl);
+                javbusUrlList.add(javbusUrl);
+            } catch (Exception e) {
+                log.error("jsoupIcodePool:javbus防屏蔽地址失效!javbusUrl={}", javbusUrl, e);
+            }
+        }
+        if (javbusUrlList.size() == 0) {
             return;
         }
 
@@ -140,7 +152,10 @@ public class BgServiceImpl implements BgService {
         // 遍历
         Document document;
         VideoInfoPool videoInfoPool;
+        String javbusUrl;
         for (int i = 0; i < icodePoolList.size(); i++) {
+
+            long start = System.currentTimeMillis();
             String identificationCode = icodePoolList.get(i);
 
             IcodePool icodePool = new IcodePool();
@@ -149,34 +164,66 @@ public class BgServiceImpl implements BgService {
                 icodePool.setStatus(4);
                 icodePool.setRetryCount(0);
                 icodePoolMapper.updateStatus(icodePool);
-                log.warn("jsoupIcodePool exists:i={},identificationCode={}", i, identificationCode);
+                log.warn("jsoupIcodePool exists:i={},time={},identificationCode={}", i, System.currentTimeMillis() - start, identificationCode);
                 continue;
             }
 
-            try {
-                document = Jsoup.connect(javbusUrl.concat(identificationCode)).timeout(50000).get();
-
-                videoInfoPool = new VideoInfoPool();
-                parseDocument(document, identificationCode, machiPath, videoInfoPool);
-                if (videoInfoPool != null) {
-                    icodePool.setStatus(2);
-                    icodePool.setRetryCount(0);
-                    icodePoolMapper.updateStatus(icodePool);
-                    videoInfoPoolMapper.insert(videoInfoPool);
-                }
+            int retryCount = 0;
+            while (retryCount <= 3) {
+                javbusUrl = javbusUrlList.get((int) (0 + Math.random() * (javbusUrlList.size() - 0)));
+                try {
+                    document = Jsoup.connect(javbusUrl.concat(identificationCode)).timeout(50000).userAgent(getUserAgent()).get();
+
+                    videoInfoPool = new VideoInfoPool();
+                    long picTime = parseDocument(document, identificationCode, machiPath, videoInfoPool);
+                    if (videoInfoPool != null) {
+                        icodePool.setStatus(2);
+                        icodePool.setRetryCount(retryCount);
+                        icodePoolMapper.updateStatus(icodePool);
+                        videoInfoPoolMapper.insert(videoInfoPool);
+                    }
 
-                log.info("jsoupIcodePool success:i={},identificationCode={}", i, identificationCode);
-            } catch (Exception e) {
-                icodePool.setStatus(3);
-                icodePool.setRetryCount(0);
-                icodePool.setFailureCause(e.getMessage().length() <= 200 ? e.getMessage() : e.getMessage().substring(0, 200));
-                icodePoolMapper.updateStatus(icodePool);
-                log.error("jsoupIcodePool error:i={},identificationCode={}", i, identificationCode, e);
+                    log.info("jsoupIcodePool success:i={},picTime={},time={},identificationCode={}", i, picTime, System.currentTimeMillis() - start, identificationCode);
+                    break;
+                } catch (Exception e) {
+                    ++retryCount;
+
+                    if (retryCount < 4) {
+                        log.error("jsoupIcodePool error重试:i={},retryCount={},time={},identificationCode={}", i, retryCount, System.currentTimeMillis() - start, identificationCode, e);
+                    } else if (retryCount == 4) {
+                        icodePool.setStatus(3);
+                        icodePool.setRetryCount(retryCount);
+                        icodePool.setFailureCause(e.getMessage().length() <= 200 ? e.getMessage() : e.getMessage().substring(0, 200));
+                        icodePoolMapper.updateStatus(icodePool);
+                        log.error("jsoupIcodePool error:i={},time={},identificationCode={}", i, System.currentTimeMillis() - start, identificationCode, e);
+                    }
+                }
             }
         }
     }
 
-    private void parseDocument(Document document, String identificationCode, String machiPath, VideoInfoPool videoInfoPool) throws Exception {
+    private String getUserAgent() {
+        Random r = new Random();
+        String[] ua = {"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0",
+                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36 OPR/37.0.2178.32",
+                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
+                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36",
+                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586",
+                "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko",
+                "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
+                "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)",
+                "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0)",
+                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 BIDUBrowser/8.3 Safari/537.36",
+                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 Core/1.47.277.400 QQBrowser/9.4.7658.400",
+                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",
+                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36 SE 2.X MetaSr 1.0",
+                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36 TheWorld 7",
+                "Mozilla/5.0 (Windows NT 6.1; W…) Gecko/20100101 Firefox/60.0"};
+        int i = r.nextInt(14);
+        return ua[i];
+    }
+
+    private long parseDocument(Document document, String identificationCode, String machiPath, VideoInfoPool videoInfoPool) throws Exception {
         Elements container = document.select("div.container");
         if (container.size() == 0) {
             throw new Exception("番号无效!");
@@ -257,13 +304,18 @@ public class BgServiceImpl implements BgService {
         // 图片URL
         String href = container.select("a.bigImage").first().attr("abs:href");
 
+        long start = System.currentTimeMillis();
         Connection.Response response = Jsoup.connect(href).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
         String fileName = issueDate.concat(" ").concat(h3).concat(".jpg");
         saveFile(response.bodyStream(), machiPath.concat(fileName));
+        long end = System.currentTimeMillis();
+
         videoInfoPool.setImgUrl(fileName);
 
         videoInfoPool.setCreateTime(LocalDateTime.now());
         videoInfoPool.setType(1);
+
+        return end - start;
     }
 
     /**

+ 12 - 15
src/main/java/top/lvzhiqiang/service/impl/VideoInfoServiceImpl.java

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
 import org.springframework.stereotype.Service;
 import top.lvzhiqiang.entity.VideoInfo;
 import top.lvzhiqiang.mapper.VideoInfoMapper;
+import top.lvzhiqiang.mapper.VideoInfoPoolMapper;
 import top.lvzhiqiang.service.VideoInfoService;
 
 import javax.annotation.Resource;
@@ -23,7 +24,8 @@ public class VideoInfoServiceImpl extends BaseServiceImpl<Object> implements Vid
 
     @Resource
     private VideoInfoMapper videoInfoMapper;
-
+    @Resource
+    private VideoInfoPoolMapper videoInfoPoolMapper;
 
     /**
      * 查询所有
@@ -53,27 +55,22 @@ public class VideoInfoServiceImpl extends BaseServiceImpl<Object> implements Vid
         Object bigType = params.get("bigType");
         List<VideoInfo> videoInfoList = new ArrayList<>();
 
+        // 转换成like
+        paramsToLike(params, "keyword", "cast");
+        // 分页
+        paramsToPagination(params);
+        // 排序
+        paramsToSort(params);
+
         if ("骑兵".equals(bigType)) {
-            // 转换成like
-            paramsToLike(params, "keyword");
-            // 分页
-            paramsToPagination(params);
-            // 排序
-            paramsToSort(params);
             videoInfoList = videoInfoMapper.getVideoInfoList(params);
         } else if ("步兵".equals(bigType)) {
 
         } else if ("流出".equals(bigType)) {
 
-        } else if ("待处理".equals(bigType)) {
-
+        } else if ("码池".equals(bigType)) {
+            videoInfoList = videoInfoPoolMapper.getVideoInfoPoolList(params);
         } else {
-            // 转换成like
-            paramsToLike(params, "keyword");
-            // 分页
-            paramsToPagination(params);
-            // 排序
-            paramsToSort(params);
             videoInfoList = videoInfoMapper.getVideoInfoList(params);
         }
 

+ 1 - 1
src/main/resources/application.yml

@@ -22,7 +22,7 @@ spring:
     name: jav
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://144.34.207.84:3306/jav?useUnicode=true&allowMultiQueries=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&useSSL=false
+    url: jdbc:mysql://144.34.207.84:3306/jav?useUnicode=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&useSSL=false
     username: root
     password: fa7777a9337be09f
     type: com.zaxxer.hikari.HikariDataSource

+ 34 - 0
src/main/resources/mapper/VideoInfoPoolMapper.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!-- 当Mapper接口和XML文件关联的时候,namespace的值就需要配置成接口的全限定名称 -->
+<mapper namespace="top.lvzhiqiang.mapper.VideoInfoPoolMapper">
+
+    <select id="getVideoInfoPoolList" resultType="top.lvzhiqiang.entity.VideoInfo">
+        select vi.id,vi.name,vi.identification_code,vi.issue_date,vi.modify_time,vi.type,vi.img_url,vi.genres AS main_who,vi.cast As score
+        from video_info_pool vi
+        where vi.delete_flag = 1
+        <if test="keyword != null and keyword != ''">
+            and (vi.name like #{keyword} or vi.identification_code like #{keyword})
+        </if>
+        <if test="genres != null and genres != ''">
+            and
+            <choose>
+                <when test="genres == '待审查'">
+                    vi.type = 1
+                </when>
+                <when test="genres == '审查已通过'">
+                    vi.type = 2
+                </when>
+                <when test="genres == '审查未通过'">
+                    vi.type = 3
+                </when>
+                <otherwise></otherwise>
+            </choose>
+        </if>
+        <if test="cast != null and cast != ''">
+            and vi.cast like #{cast}
+        </if>
+    </select>
+</mapper>

+ 5 - 1
src/main/resources/static/bg.html

@@ -38,6 +38,8 @@
         <form method="post" action="bg/uploadFile4IdentificationCode" enctype="multipart/form-data">
             <span>file</span>
             <input type="file" name="file"/>
+            <span>isDel</span>
+            <input type="text" name="isDel" placeholder="1:是,2:否。默认是"/>
             <input type="submit" value="提交">
         </form>
     </div>
@@ -46,7 +48,9 @@
         <span class="font">jsoupIcodePool</span>
         <form method="post" action="bg/jsoupIcodePool" enctype="multipart/form-data">
             <span>status</span>
-            <input type="text" name="status" placeholder="1:未爬取,2:爬取失败"/>
+            <input type="text" name="status" placeholder="1:未爬取,2:爬取失败。默认是未爬取" style="width: 300px;"/>
+            <span>isDel</span>
+            <input type="text" name="isDel" placeholder="1:是,2:否。默认是"/>
             <input type="submit" value="提交">
         </form>
     </div>

+ 5 - 5
src/main/resources/static/index.html

@@ -34,14 +34,14 @@
                         <a class="more text-muted" id="shaixuan">筛选</a>
                         <div class="myui-header__search search-box">
                             <a class="search-select dropdown-hover" href="javascript:">
-                                <span class="text" id="bigType">骑兵</span>
+                                <span class="text" id="bigType" prepath="qibing">骑兵</span>
                                 <i class="fa fa-caret-down"></i>
                                 <div class="dropdown-box bottom fadeInDown">
                                     <ul class="item" style="line-height: 140%;">
-                                        <li class="">骑兵</li>
-                                        <li class="">步兵</li>
-                                        <li class="">流出</li>
-                                        <li class="">码池</li>
+                                        <li class="" prepath="qibing">骑兵</li>
+                                        <li class="" prepath="bubing">步兵</li>
+                                        <li class="" prepath="liuchu">流出</li>
+                                        <li class="" prepath="machi">码池</li>
                                     </ul>
                                 </div>
                             </a>

+ 13 - 3
src/main/resources/static/js/my.js

@@ -33,6 +33,7 @@ function initOther() {
     });
     $(".dropdown-box").find("li").click(function () {
         $("#bigType").text($(this).text());
+        $("#bigType").attr("prepath", $(this).attr("prepath"));
         $(".dropdown-box").attr("style", "display: none;");
 
         getQueryHeaderInfo($("#bigType").text(), false);
@@ -69,6 +70,7 @@ function search(pageNo, startFlag) {
     var orderField = $(".paixuul").find(".btn-warm").attr("orderField");
     var order = $(".paixuul").find(".btn-warm").attr("order");
     var bigType = $("#bigType").text();
+    var prepath = $("#bigType").attr("prepath");
     $.ajax({
         url: "videoInfo/getVideoInfoPage", //请求的url地址
         dataType: "json", //返回格式为json
@@ -105,7 +107,7 @@ function search(pageNo, startFlag) {
 
                     str += "<li class=\"col-lg-8 col-md-6 col-sm-4 col-xs-3\">" +
                         "   <div class=\"myui-vodlist__box\">" +
-                        "       <a class=\"myui-vodlist__thumb lazyload\" title=\"\" style=\"background-image: url(&quot;qibing/" + videoInfo.imgUrl + "&quot;);\">" +
+                        "       <a class=\"myui-vodlist__thumb lazyload\" title=\"\" style=\"background-image: url(&quot;" + prepath + "/" + videoInfo.imgUrl + "&quot;);\">" +
                         "           <span class=\"playvideo play hidden-xs\" videoUrl='" + videoInfo.videoUrl + "'></span>" +
                         "           <span class=\"pic-tag pic-tag-top\">" +
                         "               <span class=\"tag identificationCode\" style=\"background-color: #FB7299;\">" + videoInfo.identificationCode + "</span>" +
@@ -115,7 +117,7 @@ function search(pageNo, startFlag) {
                         "       </a>" +
                         "       <div class=\"myui-vodlist__detail\">" +
                         "           <h4 class=\"bigpreview title text-overflow\" imgUrl='" + videoInfo.imgUrl + "' ><a title=\" " + videoInfo.name + " \">" + videoInfo.name + "</a></h4>" +
-                        "           <p class=\"text text-overflow text-muted hidden-xs\">直属:" + videoInfo.mainWho + "</p>" +
+                        "           <p class=\"text text-overflow text-muted hidden-xs\" title='" + videoInfo.mainWho + "'>直属:" + videoInfo.mainWho + "</p>" +
                         "       </div>" +
                         "   </div>" +
                         "</li>";
@@ -124,6 +126,7 @@ function search(pageNo, startFlag) {
 
                 if (str == "") {
                     $(".vodlistnone").attr("style", "padding: 50px;display: block;");
+                    $(".myui-page").html("");
                 } else {
                     $(".vodlistnone").attr("style", "padding: 50px;display: none;");
                     $(".myui-page").pagination({
@@ -210,6 +213,7 @@ function getQueryHeaderInfo(bigType, startFlag) {
                     $("#leixingdiv").html(str);
                 }
 
+                $(".searchbtn").unbind("click");
                 $(".searchbtn").click(function () {
                     $(this).closest('ul').find(".searchbtn").removeClass("btn-warm");
                     $(this).addClass("btn-warm");
@@ -254,7 +258,13 @@ function getQueryHeaderInfo(bigType, startFlag) {
  * 初始化主内容事件
  */
 function initContentEvent() {
+    var prepath = $("#bigType").attr("prepath");
+
     $(".playvideo").dblclick(function () {
+        if (prepath == "machi") {
+            return;
+        }
+
         if ($("#playvideo").css("display") === 'none') {
             $("#playvideo").css("display", "block");
             $("#playvideo").find("video").attr("src", "qibing/" + $(this).attr("videoUrl"));
@@ -267,7 +277,7 @@ function initContentEvent() {
     $(".bigpreview").dblclick(function () {
         if ($("#bigpreview").css("display") === 'none') {
             $("#bigpreview").css("display", "block");
-            $("#bigpreview").find("img").attr("src", "qibing/" + $(this).attr("imgUrl"));
+            $("#bigpreview").find("img").attr("src", prepath + "/" + $(this).attr("imgUrl"));
         } else if ($("#bigpreview").css("display") === 'block') {
             $("#bigpreview").css("display", "none");
             $("#bigpreview").find("img").attr("src", "");

+ 1 - 127
src/test/java/Test.java

@@ -52,132 +52,6 @@ public class Test {
         //System.out.println(s1);
 
 
-
-        String javbusUrl = "https://www.seejav.men/";
-        String identificationCode = "DANDY-745";// DTT-049  HAWA-243  HISN-011 DANDY-745  VOSS-172  PFES-024 VIDA-005  SHKD-843  CAWD-176  BLK-467
-        Document document;
-        VideoInfoPool videoInfoPool;
-        try {
-            document = Jsoup.connect(javbusUrl.concat(identificationCode)).timeout(50000).get();
-
-            videoInfoPool = new VideoInfoPool();
-            parseDocument(document, identificationCode, videoInfoPool);
-
-            System.out.println(videoInfoPool);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    private static void parseDocument(Document document, String identificationCode, VideoInfoPool videoInfoPool) throws Exception {
-        Elements container = document.select("div.container");
-        if (container.size() == 0) {
-            throw new Exception("番号无效!");
-        }
-
-        // 名称
-        String h3 = container.select("h3").first().text();
-        String[] nameArr = h3.split("\\s+");
-        if (nameArr.length > 1) {
-            videoInfoPool.setName(h3.substring(nameArr[0].length()).trim());
-        } else {
-            videoInfoPool.setName(nameArr[0]);
-        }
-
-        Elements pEles = container.select("div.info > p");
-        // 识别码
-        Element pEle = pEles.get(0);
-        String iCode = pEle.select("span[style]").first().text();
-        if (!identificationCode.equalsIgnoreCase(iCode)) {
-            throw new Exception("番号与站点不一致");
-        }
-        videoInfoPool.setIdentificationCode(iCode);
-        // 发行日期
-        pEle = pEles.get(1);
-        String issueDate = pEle.text().split(":")[1].replace("\"", "").trim();
-        videoInfoPool.setIssueDate(LocalDate.parse(issueDate, DateUtils.dateFormatter));
-        // 长度
-        pEle = pEles.get(2);
-        String length = pEle.text().split(":")[1].replace("\"", "").trim();
-        videoInfoPool.setLength(length);
-        // 导演
-        Elements directorEles = container.select("div.info").select("p:contains(導演)");
-        if (directorEles.size() > 0) {
-            pEle = directorEles.first().select("a[href]").first();
-            videoInfoPool.setDirector(pEle.text());
-        }
-        // 制作商
-        Elements markerEles = container.select("div.info").select("p:contains(製作商)");
-        if (markerEles.size() > 0) {
-            pEle = markerEles.first().select("a[href]").first();
-            videoInfoPool.setMaker(pEle.text());
-        }
-        // 发行商
-        Elements issuerEles = container.select("div.info").select("p:contains(發行商)");
-        if (issuerEles.size() > 0) {
-            pEle = issuerEles.first().select("a[href]").first();
-            videoInfoPool.setIssuer(pEle.text());
-        }
-        // 类别
-        Elements genresEles = container.select("div.info").select("p:contains(類別)");
-        if (genresEles.size() > 0) {
-            StringBuffer sb = new StringBuffer();
-            Elements ahrefEles = genresEles.first().nextElementSibling().select("a[href]");
-            for (Element ahrefEle : ahrefEles) {
-                sb.append(ahrefEle.text()).append(",");
-            }
-            if (sb.length() > 0) {
-                sb = sb.deleteCharAt(sb.length() - 1);
-            }
-            videoInfoPool.setGenres(sb.toString());
-        }
-        // 演员
-        Elements castEles = container.select("div.info").select("p.star-show:contains(演員)");
-        if (castEles.size() > 0) {
-            Elements castElesTemp = container.select("div.info:contains(暫無出演者資訊)");
-            if (castElesTemp.size() == 0) {
-                StringBuffer sb = new StringBuffer();
-                Elements ahrefEles = castEles.first().nextElementSibling().nextElementSibling().select("a[href]");
-                for (Element ahrefEle : ahrefEles) {
-                    sb.append(ahrefEle.text()).append(",");
-                }
-                if (sb.length() > 0) {
-                    sb = sb.deleteCharAt(sb.length() - 1);
-                }
-                videoInfoPool.setCast(sb.toString());
-            }
-        }
-        // 图片URL
-        String href = container.select("a.bigImage").first().attr("abs:href");
-
-        Connection.Response response = Jsoup.connect(href).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
-        String machiPath = "F:/1/0/2/4/视频/电影/A级(成人级)/码池/";
-        String fileName = issueDate.concat(" ").concat(h3).concat(".jpg");
-        //saveFile(response.bodyStream(), machiPath.concat(fileName));
-        videoInfoPool.setImgUrl(fileName);
-
-        videoInfoPool.setCreateTime(LocalDateTime.now());
-    }
-
-    /**
-     * 保存文件到本地
-     *
-     * @param bufferedInputStream
-     * @param savePath
-     */
-    private static void saveFile(BufferedInputStream bufferedInputStream, String savePath) throws IOException {
-        //一次最多读取1k
-        byte[] buffer = new byte[1024];
-        //实际读取的长度
-        int readLenghth;
-        //创建的一个写出的缓冲流
-        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(new File(savePath)));
-        //文件逐步写入本地
-        while ((readLenghth = bufferedInputStream.read(buffer, 0, 1024)) != -1) {//先读出来,保存在buffer数组中
-            bufferedOutputStream.write(buffer, 0, readLenghth);//再从buffer中取出来保存到本地
-        }
-        //关闭缓冲流
-        bufferedOutputStream.close();
-        bufferedInputStream.close();
+        System.out.println((int)(0 + Math.random() * (2 - 0)));
     }
 }

+ 145 - 0
src/test/java/Test2.java

@@ -0,0 +1,145 @@
+import org.jsoup.Connection;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+import top.lvzhiqiang.entity.VideoInfoPool;
+import top.lvzhiqiang.util.DateUtils;
+
+import java.io.*;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+public class Test2 {
+    public static void main(String[] args) {
+        String javbusUrl = "https://www.javbus.com/";
+        String identificationCode = "VEO-049";// DTT-049  HAWA-243  HISN-011 DANDY-745  VOSS-172  PFES-024 VIDA-005  SHKD-843  CAWD-176  BLK-467
+        Document document;
+        VideoInfoPool videoInfoPool;
+        try {
+            Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("trojan.lvzhiqiang.top", Integer.parseInt("4430")));
+            document = Jsoup.connect(javbusUrl.concat(identificationCode)).timeout(50000).proxy(proxy).get();
+
+            videoInfoPool = new VideoInfoPool();
+            parseDocument(document, identificationCode, videoInfoPool);
+
+            System.out.println(videoInfoPool);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static void parseDocument(Document document, String identificationCode, VideoInfoPool videoInfoPool) throws Exception {
+        Elements container = document.select("div.container");
+        if (container.size() == 0) {
+            throw new Exception("番号无效!");
+        }
+
+        // 名称
+        String h3 = container.select("h3").first().text();
+        String[] nameArr = h3.split("\\s+");
+        if (nameArr.length > 1) {
+            videoInfoPool.setName(h3.substring(nameArr[0].length()).trim());
+        } else {
+            videoInfoPool.setName(nameArr[0]);
+        }
+
+        Elements pEles = container.select("div.info > p");
+        // 识别码
+        Element pEle = pEles.get(0);
+        String iCode = pEle.select("span[style]").first().text();
+        if (!identificationCode.equalsIgnoreCase(iCode)) {
+            throw new Exception("番号与站点不一致");
+        }
+        videoInfoPool.setIdentificationCode(iCode);
+        // 发行日期
+        pEle = pEles.get(1);
+        String issueDate = pEle.text().split(":")[1].replace("\"", "").trim();
+        videoInfoPool.setIssueDate(LocalDate.parse(issueDate, DateUtils.dateFormatter));
+        // 长度
+        pEle = pEles.get(2);
+        String length = pEle.text().split(":")[1].replace("\"", "").trim();
+        videoInfoPool.setLength(length);
+        // 导演
+        Elements directorEles = container.select("div.info").select("p:contains(導演)");
+        if (directorEles.size() > 0) {
+            pEle = directorEles.first().select("a[href]").first();
+            videoInfoPool.setDirector(pEle.text());
+        }
+        // 制作商
+        Elements markerEles = container.select("div.info").select("p:contains(製作商)");
+        if (markerEles.size() > 0) {
+            pEle = markerEles.first().select("a[href]").first();
+            videoInfoPool.setMaker(pEle.text());
+        }
+        // 发行商
+        Elements issuerEles = container.select("div.info").select("p:contains(發行商)");
+        if (issuerEles.size() > 0) {
+            pEle = issuerEles.first().select("a[href]").first();
+            videoInfoPool.setIssuer(pEle.text());
+        }
+        // 类别
+        Elements genresEles = container.select("div.info").select("p:contains(類別)");
+        if (genresEles.size() > 0) {
+            StringBuffer sb = new StringBuffer();
+            Elements ahrefEles = genresEles.first().nextElementSibling().select("a[href]");
+            for (Element ahrefEle : ahrefEles) {
+                sb.append(ahrefEle.text()).append(",");
+            }
+            if (sb.length() > 0) {
+                sb = sb.deleteCharAt(sb.length() - 1);
+            }
+            videoInfoPool.setGenres(sb.toString());
+        }
+        // 演员
+        Elements castEles = container.select("div.info").select("p.star-show:contains(演員)");
+        if (castEles.size() > 0) {
+            Elements castElesTemp = container.select("div.info:contains(暫無出演者資訊)");
+            if (castElesTemp.size() == 0) {
+                StringBuffer sb = new StringBuffer();
+                Elements ahrefEles = castEles.first().nextElementSibling().nextElementSibling().select("a[href]");
+                for (Element ahrefEle : ahrefEles) {
+                    sb.append(ahrefEle.text()).append(",");
+                }
+                if (sb.length() > 0) {
+                    sb = sb.deleteCharAt(sb.length() - 1);
+                }
+                videoInfoPool.setCast(sb.toString());
+            }
+        }
+        // 图片URL
+        String href = container.select("a.bigImage").first().attr("abs:href");
+
+        Connection.Response response = Jsoup.connect(href).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
+        String machiPath = "F:/1/0/2/4/视频/电影/A级(成人级)/码池/";
+        String fileName = issueDate.concat(" ").concat(h3).concat(".jpg");
+        //saveFile(response.bodyStream(), machiPath.concat(fileName));
+        videoInfoPool.setImgUrl(fileName);
+
+        videoInfoPool.setCreateTime(LocalDateTime.now());
+    }
+
+    /**
+     * 保存文件到本地
+     *
+     * @param bufferedInputStream
+     * @param savePath
+     */
+    private static void saveFile(BufferedInputStream bufferedInputStream, String savePath) throws IOException {
+        //一次最多读取1k
+        byte[] buffer = new byte[1024];
+        //实际读取的长度
+        int readLenghth;
+        //创建的一个写出的缓冲流
+        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(new File(savePath)));
+        //文件逐步写入本地
+        while ((readLenghth = bufferedInputStream.read(buffer, 0, 1024)) != -1) {//先读出来,保存在buffer数组中
+            bufferedOutputStream.write(buffer, 0, readLenghth);//再从buffer中取出来保存到本地
+        }
+        //关闭缓冲流
+        bufferedOutputStream.close();
+        bufferedInputStream.close();
+    }
+}