| | |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVVideo2Dao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.VideoFunTV2Dao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.VideoFunTVNewDao; |
| | | import com.yeshi.buwan.videos.funtv.FunTVNewApi; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.videos.funtv.entity.FunTVAlbum2; |
| | | import com.yeshi.buwan.videos.funtv.entity.FunTVVideo2; |
| | | import com.yeshi.buwan.videos.funtv.entity.VideoFunTV2; |
| | | import com.yeshi.buwan.job.video.FunTV2VideoUpdate; |
| | | import com.yeshi.buwan.service.imp.ResourceVideoService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.inter.juhe.FunTV2Service; |
| | | import com.yeshi.buwan.util.HtmlToolUtil; |
| | | import com.yeshi.buwan.vo.video.funtv.Funtv2ResultVO; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.videos.funtv.entity.FunTVAlbum2; |
| | | import com.yeshi.buwan.videos.funtv.entity.FunTVVideo2; |
| | | import com.yeshi.buwan.videos.funtv.entity.VideoFunTV2; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.FileInputStream; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Scanner; |
| | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | @Test |
| | | public void test1() { |
| | | // long now = System.currentTimeMillis(); |
| | | // for (int d = 200; d >= 100; d--) { |
| | | // Funtv2ResultVO result = FunTVNewApi.getVideos(1, 20, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), 1013, 1); |
| | | // if (result != null && result.getList() != null && result.getList().size() > 0) |
| | | // System.out.println(result); |
| | | // } |
| | | } |
| | | |
| | | @Test |
| | | public void syncAlbum() { |
| | | //1-电影 2-电视剧 3-动漫 4-综艺 5-少儿 |
| | | int channelId = 2; |
| | | Funtv2ResultVO vo = FunTVNewApi.getAlbums(1, 20, null, null, 1); |
| | | int totalCount = vo.getCount(); |
| | | int pageSize = 20; |
| | | int totalPage = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1; |
| | | for (int p = 0; p < totalPage; p++) { |
| | | Funtv2ResultVO result = FunTVNewApi.getAlbums(p + 1, pageSize, null, null, 1); |
| | | if (result != null) |
| | | for (Serializable a : result.getList()) { |
| | | FunTVAlbum2 album2 = (FunTVAlbum2) a; |
| | | funTV2Service.saveAlbum(album2); |
| | | if (album2.getEpisodes() != null) |
| | | for (FunTVVideo2 video2 : album2.getEpisodes()) |
| | | funTV2Service.saveVideo(video2); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Test |
| | | // public void syncShortVideo() { |
| | | // long now = System.currentTimeMillis(); |
| | | // for (int d = 30; d >= 0; d--) { |
| | | // List<FunTVShortVideo2> shortVideo2List = new ArrayList<>(); |
| | | // int pageSize = 100; |
| | | // Funtv2ResultVO result = FunTVNewApi.getVideos(1, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, 1); |
| | | // if (result != null) { |
| | | // for (Serializable a : result.getList()) { |
| | | // FunTVShortVideo2 video2 = (FunTVShortVideo2) a; |
| | | // shortVideo2List.add(video2); |
| | | // } |
| | | // } |
| | | // int count = result.getCount(); |
| | | // int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | // if (totalPage > 1) |
| | | // for (int p = 1; p < totalPage; p++) { |
| | | // result = FunTVNewApi.getVideos(p + 1, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, 1); |
| | | // if (result != null) { |
| | | // for (Serializable a : result.getList()) { |
| | | // FunTVShortVideo2 video2 = (FunTVShortVideo2) a; |
| | | // shortVideo2List.add(video2); |
| | | // } |
| | | // } |
| | | // } |
| | | // for (FunTVShortVideo2 video2 : shortVideo2List) { |
| | | // funTV2Service.saveShortVideo(video2); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | @Test |
| | | public void addToVideoInfo() { |
| | |
| | | @Test |
| | | public void addToVideoInfo1() { |
| | | videoInfoService.statisticVideoExtraInfo(179210 + ""); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void getAccessToken() { |
| | | System.out.println(FunTVNewApi.getAccessToken()); |
| | | } |
| | | |
| | | |