From f13ed98e1de0ec7b85ed179212cc095f63480eed Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 25 三月 2021 18:18:20 +0800 Subject: [PATCH] 全网搜优酷兼容 --- src/test/java/com/hxh/spring/test/PPTVTest.java | 68 ++++++++++++++++++++++------------ 1 files changed, 44 insertions(+), 24 deletions(-) diff --git a/src/test/java/com/hxh/spring/test/PPTVTest.java b/src/test/java/com/hxh/spring/test/PPTVTest.java index 03cc422..d6d1344 100644 --- a/src/test/java/com/hxh/spring/test/PPTVTest.java +++ b/src/test/java/com/hxh/spring/test/PPTVTest.java @@ -30,9 +30,9 @@ import java.util.*; -@RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 -@ContextConfiguration(locations = {"classpath:spring.xml"}) -@WebAppConfiguration +//@RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 +//@ContextConfiguration(locations = {"classpath:spring.xml"}) +//@WebAppConfiguration public class PPTVTest { @Resource @@ -80,6 +80,18 @@ } catch (Exception e) { e.printStackTrace(); } + +// List<PPTVSeries> list = PPTVApiUtil.getUpdateList(); +// System.out.println(list); + } + + @Test + public void syncVideo() { + try { + pptvVideoUpdate.syncVideo(""); + } catch (Exception e) { + e.printStackTrace(); + } } @Test @@ -90,7 +102,7 @@ @Test public void getApiDetail() { - PPTVApiUtil.getDetail("32159127,10215224,15326213"); + PPTVApiUtil.getDetail("9040633"); } @@ -119,8 +131,11 @@ @Test public void addVideoInfo() { - PPTVSeries series = pptvService.getSeriesDetail("26796"); +// List<PPTVSeries> seriesList = pptvSeriesDao.list("灏戝効", 0, 100); +// for (PPTVSeries series : seriesList) { + PPTVSeries series = pptvService.getSeriesDetail("381472"); pptvService.addToVideoInfo(series); +// } } @Test @@ -175,7 +190,7 @@ Sheet sheet = rwb.getSheet(sheetNum); for (int c = 1; c < sheet.getRows(); c++) { String infoId = sheet.getCell(0, c).getContents().trim(); - String name = sheet.getCell(2, c).getContents().trim(); + String name = sheet.getCell(1, c).getContents().trim(); String del = sheet.getCell(21, c).getContents().trim(); if (!StringUtil.isNullOrEmpty(infoId) && StringUtil.isNullOrEmpty(del)) { videoList.add(new String[]{infoId, name, del}); @@ -194,31 +209,37 @@ List<String[]> list1 = getPPTVVideos(new File("C:\\Users\\Administrator\\Desktop\\鍏ㄩ噺.xls"), 0); List<String[]> list2 = getPPTVVideos(new File("C:\\Users\\Administrator\\Desktop\\鍏ㄩ噺.xls"), 1); Map<String, String[]> map = new TreeMap<>(); + Set<String> sets = new HashSet<>(); for (String[] sts : list1) { map.put(sts[0], sts); + sets.add(sts[1]); } for (String[] sts : list2) { map.put(sts[0], sts); + sets.add(sts[1]); } - List<PPTVSeries> list = pptvSeriesDao.list(0, 10000); - Set<String> infoIds = new HashSet<>(); - for (PPTVSeries s : list) { - infoIds.add(s.getInfoID()); - } +// List<PPTVSeries> list = pptvSeriesDao.list(0, 10000); +// Set<String> infoIds = new HashSet<>(); +// for (PPTVSeries s : list) { +// infoIds.add(s.getInfoID()); +// } +// +// for (String infoId : infoIds) { +// map.remove(infoId); +// } - for (String infoId : infoIds) { - map.remove(infoId); - } + for (String code : sets) + getDetail(code); - try { - save(map); - } catch (Exception e) { - e.printStackTrace(); - } +// try { +// save(map); +// } catch (Exception e) { +// e.printStackTrace(); +// } - System.out.println(map); +// System.out.println(map); } private void save(Map<String, String[]> data) throws Exception { @@ -251,11 +272,10 @@ } } - @Test - public void getDetail() { - PPTVSeries series = PPTVApiUtil.getDetail("32385373"); + // @Test + public void getDetail(String sCode) { + PPTVSeries series = PPTVApiUtil.getDetail(sCode); pptvService.save(series); - System.out.println(series); } -- Gitblit v1.8.0