From 19533a17aa55fafc70d0a385928e785cb50e1ebc Mon Sep 17 00:00:00 2001 From: admin <2780501319@qq.com> Date: 星期五, 30 七月 2021 02:05:14 +0800 Subject: [PATCH] 爱奇艺视频更新 --- src/test/java/com/hxh/spring/test/PPTVTest.java | 85 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 77 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/hxh/spring/test/PPTVTest.java b/src/test/java/com/hxh/spring/test/PPTVTest.java index aa22cfd..412f4b4 100644 --- a/src/test/java/com/hxh/spring/test/PPTVTest.java +++ b/src/test/java/com/hxh/spring/test/PPTVTest.java @@ -1,10 +1,16 @@ package com.hxh.spring.test; +import com.google.gson.Gson; +import com.yeshi.buwan.dao.juhe.pptv.PPTVProgramDao; import com.yeshi.buwan.dao.juhe.pptv.PPTVSeriesDao; +import com.yeshi.buwan.dao.juhe.pptv.PPTVSeriesProgramMapDao; +import com.yeshi.buwan.dao.juhe.pptv.VideoPPTVMapDao; import com.yeshi.buwan.job.video.PPTVVideoUpdate; import com.yeshi.buwan.pptv.PPTVApiUtil; import com.yeshi.buwan.pptv.PPTVUtil; import com.yeshi.buwan.pptv.entity.PPTVSeries; +import com.yeshi.buwan.pptv.entity.PPTVSeriesProgramMap; +import com.yeshi.buwan.pptv.entity.VideoPPTVMap; import com.yeshi.buwan.service.inter.LoginUserService; import com.yeshi.buwan.service.inter.juhe.PPTVService; import com.yeshi.buwan.util.StringUtil; @@ -43,6 +49,17 @@ @Resource private PPTVSeriesDao pptvSeriesDao; + + @Resource + private PPTVProgramDao pptvProgramDao; + + @Resource + private PPTVSeriesProgramMapDao pptvSeriesProgramMapDao; + + @Resource + private VideoPPTVMapDao videoPPTVMapDao; + + @Resource private PPTVVideoUpdate pptvVideoUpdate; @@ -57,15 +74,41 @@ @Test public void addToVideoInfo() { - List<PPTVSeries> list = pptvSeriesDao.list(2000, 1000); - for (PPTVSeries s : list) { - if (s.getProgramType().contains("灏戝効") || s.getProgramType2().contains("灏戝効")) { - continue; +// List<PPTVSeries> list = pptvSeriesDao.list(2000, 1000); +// for (PPTVSeries s : list) { +// if (s.getProgramType().contains("灏戝効") || s.getProgramType2().contains("灏戝効")) { +// continue; +// } +// System.out.println(s.getName() + ":" + s.getInfoID()); + + Query query = new Query(); + query.addCriteria(new Criteria().orOperator(Criteria.where("programType").regex("鐢靛奖"), Criteria.where("programType2").regex("鐢靛奖"))); + + List<String> list = new ArrayList<>(); + + List<PPTVSeries> seriesList = pptvSeriesDao.findList(query); + for (PPTVSeries series : seriesList) { + VideoPPTVMap map = pptvService.selectVideoPPTVMapByPPInfo(series.getInfoID(), null); + + if (map != null && map.getProgramCode() == null) { + series = pptvService.getSeriesDetail(series.getInfoID()); + map.setSeriesCode(series.getSeriesCode()); + map.setProgramCode(series.getSeries().get(0).getProgramCode()); + videoPPTVMapDao.save(map); + } else { + if (map == null) { + list.add(series.getInfoID()); +// series = PPTVApiUtil.getDetail(series.getSeriesCode()); + series = pptvService.getSeriesDetail(series.getInfoID()); + pptvService.addToVideoInfo(series); + } } - System.out.println(s.getName() + ":" + s.getInfoID()); - PPTVSeries series = pptvService.getSeriesDetail(s.getInfoID()); - pptvService.addToVideoInfo(series); } + + System.out.println(new Gson().toJson(list)); + + +// } } @@ -89,7 +132,7 @@ @Test public void syncVideo() { try { - pptvVideoUpdate.syncVideo(""); + pptvVideoUpdate.syncVideo("32427297"); } catch (Exception e) { e.printStackTrace(); } @@ -303,4 +346,30 @@ } + @Test + public void repaire() { + + Query query = new Query(); + query.addCriteria(Criteria.where("seriesCode").is(null)); + query.limit(200); + List<PPTVSeries> list = pptvSeriesDao.findList(query); + for (PPTVSeries pptvSeries : list) { + PPTVSeriesProgramMap map = pptvSeriesProgramMapDao.getLatestByInfoId(pptvSeries.getInfoID()); + pptvService.syncSeries(map.getSeriesCode()); + } + + + } + + @Test + public void sync() { +// PPTVSeries series = pptvService.getSeriesDetailByVideoId("8268375"); +// System.out.println(series); + + + getDetail("32501376"); + + } + + } -- Gitblit v1.8.0