| | |
| | | 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.funtv.FunTVUtil2; |
| | | import com.yeshi.buwan.funtv.entity.VideoFunTV2; |
| | | 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.entity.VideoIqiyi2; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.iqiyi.vo.IqiyiAlbumListResult; |
| | | import com.yeshi.buwan.job.SMSJob; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.exception.video.IqiyiVideoSolrException; |
| | | 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.util.*; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | 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.rabbit.RabbitmqManager; |
| | | 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 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; |
| | |
| | | @WebAppConfiguration |
| | | public class Iqiyi2 { |
| | | |
| | | private final static Logger errorLogger = LoggerFactory.getLogger("errorLogger"); |
| | | |
| | | @Resource |
| | | private IqiyiUtil2 iqiyiUtil2; |
| | | |
| | |
| | | private Iqiyi2Service iqiyi2Service; |
| | | |
| | | @Resource |
| | | private Iqiyi2VideoUpdate iqiyi2VideoUpdate; |
| | | |
| | | @Resource |
| | | private CategoryVideoService categoryVideoService; |
| | | |
| | | @Resource |
| | | private VideoIqiyi2Dao videoIqiyi2Dao; |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | private Iqiyi2VideoUpdate iqiyi2VideoUpdate; |
| | | |
| | | |
| | | @Test |
| | |
| | | |
| | | @Test |
| | | public void syncOne() { |
| | | iqiyiUtil2.syncByAid(111367401L); |
| | | iqiyiUtil2.syncByAid(111367401L, true); |
| | | // iqiyiUtil2.syncByAid(253393601L); |
| | | // iqiyiUtil2.syncByAid(253305701L); |
| | | // iqiyiUtil2.syncByAid(247742201L); |
| | |
| | | // 246508201L, 248886801L, 230798901L, 1569537751867101L, |
| | | // }; |
| | | |
| | | iqiyiUtil2.syncByAid(7643537550826500L); |
| | | iqiyiUtil2.syncByAid(3697683745816301L,true); |
| | | |
| | | // IqiyiAlbum2 album2 = iqiyi2Service.selectAlbumById(240793601L); |
| | | // if (album2 != null) { |
| | | // iqiyi2Service.addToVideoInfo(album2); |
| | | // } |
| | | |
| | | Long qikuID = 3697683745816301L; |
| | | |
| | | IqiyiAlbum2 album2 = iqiyi2Service.selectAlbumById(qikuID); |
| | | if (album2 != null) { |
| | | iqiyi2Service.addToVideoInfo(album2); |
| | | } |
| | | |
| | | // CMQManager.getInstance().addSolrMsg(8169108L+""); |
| | | |
| | | |
| | | // errorLogger.error("测试错误"); |
| | | |
| | | } |
| | | |
| | | |
| | | @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() { |
| | | for (int i = 0; i < 10; i++) { |
| | | List<Long> ids = iqiyiAlbum2Dao.listInvalid(0, 1000); |
| | | for (long id : ids) |
| | | iqiyiAlbum2Dao.delete(id); |
| | | //saveToFile(ids); |
| | | try { |
| | | iqiyi2VideoUpdate.updateVideoByPlayerUrl("https://www.iqiyi.com/v_u3d4t2dr7o.html?vfrm=pcw_dianshiju&vfrmblk=B&vfrmrst=fcs_2_p2"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | public void count() { |
| | | // long count = iqiyiAlbum2Dao.countVideoByAid(253120001L); |
| | | // System.out.println(count); |
| | | IqiyiAlbum2 album2 = iqiyiAlbum2Dao.get(730266600L); |
| | | IqiyiAlbum2 album2 = iqiyiAlbum2Dao.get(2928406697871201L); |
| | | iqiyi2Service.addToVideoInfo(album2); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void sync() { |
| | | |
| | | iqiyi2Service.convertAlbumToVideoInfo(iqiyiAlbum2Dao.get(253593801L)); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private RabbitmqManager rabbitmqManager; |
| | | |
| | | |
| | | @Test |
| | | public void addToMQ() { |
| | |
| | | for (IqiyiAlbum2 album2 : album2List) { |
| | | System.out.println(album2.getName()); |
| | | if (IqiyiUtil2.albumIsValid(album2)) { |
| | | CMQManager.getInstance().addIqiyiAlbumUpdateMsg(album2.getId()); |
| | | rabbitmqManager.addIqiyiAlbumUpdateMsg(album2.getId()); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | |
| | | @Resource |
| | | private SolrAlbumVideoDataManager solrDataManager; |
| | | |
| | | @Test |
| | | public void addResources() { |
| | | // List<String> videoIds = new ArrayList<>(); |
| | | // List<VideoIqiyi2> list = videoIqiyi2Dao.listAll(0, 5000); |
| | | // for (VideoIqiyi2 video : list) { |
| | | // long count = resourceVideoService.countByVideoIdAndResourceId(video.getVideoId() + "", IqiyiUtil2.RESOURCE_ID); |
| | | // if (count == 0L) { |
| | | // videoIds.add(video.getVideoId() + ""); |
| | | try { |
| | | VideoInfo videoInfo = videoInfoService.getVideoInfo(8174476 + ""); |
| | | if (videoInfo != null) { |
| | | if ("1".equalsIgnoreCase(videoInfo.getShow())) { |
| | | List<VideoResource> resourceList = new ArrayList<>(); |
| | | List<ResourceVideo> rvList = resourceVideoService.getResourceList(videoInfo.getId()); |
| | | if (rvList != null) |
| | | for (ResourceVideo rv : rvList) |
| | | resourceList.add(rv.getResource()); |
| | | videoInfo.setResourceList(resourceList); |
| | | solrDataManager.saveOrUpdate(videoInfo); |
| | | } else |
| | | solrDataManager.deleteById(videoInfo.getId()); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private VideoIqiyi2Dao videoIqiyi2Dao; |
| | | |
| | | @Test |
| | | public void getDetail() { |
| | | |
| | | |
| | | iqiyiUtil2.syncByAid(2928406697871201L, true); |
| | | // System.out.println(album2); |
| | | } |
| | | |
| | | //同步爱奇艺的专题 |
| | | @Test |
| | | public void syncIqiyiAlbum() throws IOException { |
| | | //写入爱奇艺ID |
| | | // 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(); |
| | | // } |
| | | |
| | | String json = "[\"588808\",\"466573\",\"475946\",\"328312\",\"475934\",\"359261\",\"276279\",\"322163\",\"276768\"]"; |
| | | JSONArray array = JSONArray.fromObject(json); |
| | | for (int i = 0; i < array.size(); i++) { |
| | | resourceVideoService.addVideoResource(array.optString(i), IqiyiUtil2.RESOURCE_ID + ""); |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | //["588808","466573","475946","328312","475934","359261","276279","322163","276768"] |
| | | @Test |
| | | public void validSolrState() { |
| | | try { |
| | | iqiyi2Service.validAlbumSolrState(2928406697871201L); |
| | | } catch (IqiyiVideoSolrException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |