From f788607ff771a47bc60d6a86e00b3433c40f3d2c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 24 九月 2021 15:22:03 +0800
Subject: [PATCH] 接入视频直播

---
 src/test/java/com/hxh/spring/test/Iqiyi2.java |   90 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 76 insertions(+), 14 deletions(-)

diff --git a/src/test/java/com/hxh/spring/test/Iqiyi2.java b/src/test/java/com/hxh/spring/test/Iqiyi2.java
index 78fb885..b59e649 100644
--- a/src/test/java/com/hxh/spring/test/Iqiyi2.java
+++ b/src/test/java/com/hxh/spring/test/Iqiyi2.java
@@ -2,29 +2,34 @@
 
 import com.google.gson.Gson;
 import com.yeshi.buwan.dao.juhe.iqiyi.IqiyiAlbum2Dao;
+import com.yeshi.buwan.dao.juhe.iqiyi.VideoIqiyi2Dao;
 import com.yeshi.buwan.dao.juhe.iqiyi.VideoIqiyiDao;
 import com.yeshi.buwan.domain.ResourceVideo;
 import com.yeshi.buwan.domain.VideoInfo;
 import com.yeshi.buwan.domain.VideoResource;
-import com.yeshi.buwan.iqiyi.IqiYiNewAPI;
-import com.yeshi.buwan.iqiyi.entity.IqiyiAlbum2;
-import com.yeshi.buwan.iqiyi.entity.VideoIqiyi;
-import com.yeshi.buwan.iqiyi.util.IqiyiUtil2;
-import com.yeshi.buwan.iqiyi.vo.IqiyiAlbumListResult;
+import com.yeshi.buwan.exception.video.IqiyiVideoSolrException;
+import com.yeshi.buwan.videos.iqiyi.IqiYiNewAPI;
+import com.yeshi.buwan.videos.iqiyi.entity.IqiyiAlbum2;
+import com.yeshi.buwan.videos.iqiyi.entity.VideoIqiyi;
+import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil2;
+import com.yeshi.buwan.videos.iqiyi.vo.IqiyiAlbumListResult;
 import com.yeshi.buwan.job.video.Iqiyi2VideoUpdate;
 import com.yeshi.buwan.query.Iqiyi2AlbumQuery;
 import com.yeshi.buwan.service.imp.CategoryVideoService;
 import com.yeshi.buwan.service.imp.ResourceVideoService;
 import com.yeshi.buwan.service.imp.VideoInfoService;
 import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service;
-import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager;
-import com.yeshi.buwan.util.*;
+import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager;
+import com.yeshi.buwan.util.HtmlToolUtil;
+import com.yeshi.buwan.util.StringUtil;
+import com.yeshi.buwan.util.TimeUtil;
 import com.yeshi.buwan.util.mq.CMQManager;
 import net.sf.json.JSONArray;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.orm.hibernate4.HibernateObjectRetrievalFailureException;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.test.context.web.WebAppConfiguration;
@@ -86,7 +91,7 @@
 
     @Test
     public void syncOne() {
-        iqiyiUtil2.syncByAid(111367401L);
+        iqiyiUtil2.syncByAid(111367401L, true);
 //        iqiyiUtil2.syncByAid(253393601L);
 //        iqiyiUtil2.syncByAid(253305701L);
 //        iqiyiUtil2.syncByAid(247742201L);
@@ -118,7 +123,7 @@
 //            iqiyi2Service.addToVideoInfo(album2);
 //        }
 
-        Long qikuID = 6376917677133701L;
+        Long qikuID = 6917577458483001L;
 
         IqiyiAlbum2 album2 = iqiyi2Service.selectAlbumById(qikuID);
         if (album2 != null) {
@@ -135,17 +140,17 @@
 
     @Test
     public void updateLatest() {
-        List<String> urlList = IqiyiUtil2.getAlbumUrlsFromUrl("https://list.iqiyi.com/www/2/15-------------11-1-1-iqiyi--.html?s_source=PCW_LC");
+        List<String> urlList = IqiyiUtil2.getAlbumUrlsFromUrl("https://www.iqiyi.com/v_u3d4t2dr7o.html?vfrm=pcw_dianshiju&vfrmblk=B&vfrmrst=fcs_2_p2");
         for (String url : urlList) {
             String aid = IqiYiNewAPI.getAidByUrl(url);
-            iqiyiUtil2.syncByAid(Long.parseLong(aid));
+            iqiyiUtil2.syncByAid(Long.parseLong(aid), true);
         }
     }
 
     @Test
     public void test6() {
         try {
-            iqiyi2VideoUpdate.updateVideoByPlayerUrl("https://www.iqiyi.com/v_1nwrspklijs.html?vfrm=pcw_dianshiju&vfrmblk=B&vfrmrst=fcs_2_p1");
+            iqiyi2VideoUpdate.updateVideoByPlayerUrl("https://www.iqiyi.com/v_u3d4t2dr7o.html?vfrm=pcw_dianshiju&vfrmblk=B&vfrmrst=fcs_2_p2");
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -178,7 +183,7 @@
     public void count() {
 //        long count = iqiyiAlbum2Dao.countVideoByAid(253120001L);
 //        System.out.println(count);
-        IqiyiAlbum2 album2 = iqiyiAlbum2Dao.get(7974832045751601L);
+        IqiyiAlbum2 album2 = iqiyiAlbum2Dao.get(2928406697871201L);
         iqiyi2Service.addToVideoInfo(album2);
     }
 
@@ -273,7 +278,7 @@
     @Test
     public void addResources() {
         try {
-            VideoInfo videoInfo = videoInfoService.getVideoInfo(8174476+"");
+            VideoInfo videoInfo = videoInfoService.getVideoInfo(8174476 + "");
             if (videoInfo != null) {
                 if ("1".equalsIgnoreCase(videoInfo.getShow())) {
                     List<VideoResource> resourceList = new ArrayList<>();
@@ -291,4 +296,61 @@
     }
 
 
+    @Resource
+    private VideoIqiyi2Dao videoIqiyi2Dao;
+
+    @Test
+    public void getDetail() {
+
+
+        iqiyiUtil2.syncByAid(2928406697871201L, true);
+//        System.out.println(album2);
+    }
+
+    //鍚屾鐖卞鑹虹殑涓撻
+    @Test
+    public void syncIqiyiAlbum() throws IOException {
+//鍐欏叆鐖卞鑹篒D
+//        File f = new File("D:/iqiyi.txt");
+//        f.delete();
+//        if (!f.exists())
+//            f.createNewFile();
+//        BufferedWriter out = new BufferedWriter(new FileWriter(f.getAbsolutePath()));
+//        try {
+//            for (int i = 0; i < 261; i++) {
+//                List<VideoIqiyi2> list = videoIqiyi2Dao.listAll(i*100, 100);
+//                for (VideoIqiyi2 iqiyi2 : list) {
+//                    out.write(iqiyi2.getIqiyiId() + "");
+//                    out.newLine();
+//                }
+//            }
+//        } finally {
+//            out.close();
+//        }
+
+        List<String> list = new ArrayList<>();
+        Scanner scanner = new Scanner(new File("D:/iqiyi.txt"));
+        while (scanner.hasNextLine()) {
+            String line = scanner.nextLine();
+            list.add(line.trim());
+        }
+        scanner.close();
+        for (int i = 25244; i < list.size(); i++)
+            try {
+                iqiyiUtil2.syncByAid(Long.parseLong(list.get(i)), true);
+            } catch (HibernateObjectRetrievalFailureException e) {
+                e.printStackTrace();
+            }
+    }
+
+    @Test
+    public void validSolrState() {
+        try {
+            iqiyi2Service.validAlbumSolrState(2928406697871201L);
+        } catch (IqiyiVideoSolrException e) {
+            e.printStackTrace();
+        }
+    }
+
+
 }

--
Gitblit v1.8.0