admin
2025-02-20 f537abe9f3646c739beaf15076246a2f71a347e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.hxh.spring.test.video;
 
 
import com.yeshi.buwan.job.video.TencentVideoUpdate;
import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService;
import com.yeshi.buwan.service.inter.juhe.TencentVideoService;
import com.yeshi.buwan.util.Constant;
import com.yeshi.buwan.videos.tencent.entity.TencentCoverInfo;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.StopWatch;
 
import javax.annotation.Resource;
import java.util.List;
 
//
@RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试
@ContextConfiguration(locations = {"classpath:spring.xml"})
@WebAppConfiguration
public class TencentTest {
 
    @Resource
    private TencentVideoService tencentVideoService;
 
 
    @Resource
    private TencentVideoUpdate tencentVideoUpdate;
 
 
    @Resource
    private InternetSearchVideoService internetSearchVideoService;
 
 
    @Test
    public void test2() {
        Constant.IsOutNet = false;
        try {
            tencentVideoUpdate.updateCategory("电影",1,1,null);
            tencentVideoUpdate.updateCategory("电视剧",1,1,null);
            tencentVideoUpdate.updateCategory("动漫",1,1,null);
//            TencentCoverInfo coverInfo =     tencentVideoService.getSimpleCoverDetail("m441e3rjq9kwpsc");
//            System.out.println(coverInfo.toString());
 
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
 
    @Test
    public void testAddHanJu() {
        Constant.IsOutNet = false;
        try {
//            tencentVideoUpdate.updateCategory("电影",1,9,100028);
            tencentVideoUpdate.updateCategory("电视剧",1,1,5);
//            TencentCoverInfo coverInfo =     tencentVideoService.getSimpleCoverDetail("m441e3rjq9kwpsc");
//            System.out.println(coverInfo.toString());
 
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
    @Test
    public void test3() {
        try {
            JSONObject data = new JSONObject();
            data.put("url", "https://v.qq.com/channel/movie?_all=1&channel=movie&charge=4&listpage=1&sort=18");
            for (int p = 1; p < 20; p++) {
                data.put("page", p);
                tencentVideoUpdate.updateLatestVideoByWebUrl(data.toString());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
    @Test
    public void addToSearch() {
        Constant.IsOutNet = false;
        List<TencentCoverInfo> list = tencentVideoService.list(null, 1, 1000);
        for (TencentCoverInfo info : list) {
            try {
                tencentVideoService.addToInternetSearch(info, false);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    @Test
    public void clearOffLine(){
        Constant.IsOutNet = false;
        tencentVideoService.clearOfflineCovers();
    }
 
 
}