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/video/YouKuTest.java | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 51 insertions(+), 1 deletions(-) diff --git a/src/test/java/com/hxh/spring/test/video/YouKuTest.java b/src/test/java/com/hxh/spring/test/video/YouKuTest.java index 3b3e0fc..9ae8297 100644 --- a/src/test/java/com/hxh/spring/test/video/YouKuTest.java +++ b/src/test/java/com/hxh/spring/test/video/YouKuTest.java @@ -1,7 +1,13 @@ package com.hxh.spring.test.video; +import com.yeshi.buwan.domain.video.InternetSearchVideo; import com.yeshi.buwan.job.video.YouKuVideoUpdate; +import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; +import com.yeshi.buwan.service.inter.juhe.YouKuService; +import com.yeshi.buwan.util.factory.InternetSearchVideoFactory; +import com.yeshi.buwan.videos.youku.YouKuApiUtil; +import com.yeshi.buwan.videos.youku.entity.YouKuShowDetail; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -9,7 +15,9 @@ import org.springframework.test.context.web.WebAppConfiguration; import javax.annotation.Resource; +import java.util.List; +// @RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 @ContextConfiguration(locations = {"classpath:spring.xml"}) @WebAppConfiguration @@ -18,10 +26,52 @@ @Resource private YouKuVideoUpdate youKuVideoUpdate; + @Resource + private InternetSearchVideoService internetSearchVideoService; + + @Resource + private YouKuService youKuService; + @Test public void test1() { try { - youKuVideoUpdate.updateLatestVideo("鍔ㄦ极"); + youKuVideoUpdate.updateLatestVideo("bb8e820fe05d414a8232"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + + @Test + public void test2() { + List<YouKuShowDetail> details = youKuService.list("鐢靛奖", 1, 2000); + for (YouKuShowDetail detail : details) { + try { + InternetSearchVideo video = InternetSearchVideoFactory.create(detail); + internetSearchVideoService.save(video); + } catch (Exception e) { + System.out.println(detail.getName() + ":" + detail.getId()); + e.printStackTrace(); + } + } + } + + @Test + public void test3() { + try { + youKuVideoUpdate.updatebyCategoryUrl("https://www.youku.com/category/show/c_96_s_1.html?theme=dark"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void getDetail() { + YouKuShowDetail detail = YouKuApiUtil.getShowDetail("ceba4745ea10415eb791"); + try { + youKuService.addToInternetSearch(detail); } catch (Exception e) { e.printStackTrace(); } -- Gitblit v1.8.0