|
@@ -47,87 +47,54 @@ class TestBingVideosEngine(SearxTestCase):
|
47
|
47
|
self.assertEqual(bing_videos.response(response), [])
|
48
|
48
|
|
49
|
49
|
html = """
|
50
|
|
- <div>
|
51
|
|
- <div class="dg_u">
|
52
|
|
- <a class="dv_i" href="/videos/search?abcde">
|
53
|
|
- <div class="vthblock">
|
54
|
|
- <div class="vthumb">
|
|
50
|
+ <div class="dg_u">
|
|
51
|
+ <div id="mc_vtvc_1" class="mc_vtvc">
|
|
52
|
+ <a class="mc_vtvc_link" href="/video">
|
|
53
|
+ <div class="mc_vtvc_th">
|
|
54
|
+ <div class="cico">
|
55
|
55
|
<img src="thumb_1.jpg" />
|
56
|
56
|
</div>
|
57
|
|
- <div>
|
58
|
|
- <div class="tl">
|
59
|
|
- Title 1
|
|
57
|
+ <div class="mc_vtvc_ban_lo">
|
|
58
|
+ <div class="vtbc">
|
|
59
|
+ <div class="mc_bc_w b_smText">
|
|
60
|
+ <div class="mc_bc pivot bpi_2">
|
|
61
|
+ <span title="">
|
|
62
|
+ <span class="mv_vtvc_play cipg "></span>
|
|
63
|
+ </span>
|
|
64
|
+ </div>
|
|
65
|
+ <div class="mc_bc items">10:06</div>
|
|
66
|
+ </div>
|
60
|
67
|
</div>
|
61
|
68
|
</div>
|
62
|
|
- </div>
|
63
|
|
- <div class="videoInfoPanel">
|
64
|
|
- <div class="pubInfo">
|
65
|
|
- <div>Content 1</div>
|
66
|
69
|
</div>
|
67
|
|
- </div>
|
68
|
|
- </a>
|
69
|
|
- <div class="sa_wrapper"
|
70
|
|
- data-eventpayload="{"purl": "https://url.com/1"}">
|
71
|
|
- </div>
|
72
|
|
- </div>
|
73
|
|
- </div>
|
74
|
|
- """
|
75
|
|
- response = mock.Mock(text=html)
|
76
|
|
- results = bing_videos.response(response)
|
77
|
|
- self.assertEqual(type(results), list)
|
78
|
|
- self.assertEqual(len(results), 1)
|
79
|
|
- self.assertEqual(results[0]['title'], 'Title 1')
|
80
|
|
- self.assertEqual(results[0]['url'], 'https://url.com/1')
|
81
|
|
- self.assertEqual(results[0]['content'], 'Content 1')
|
82
|
|
- self.assertEqual(results[0]['thumbnail'], 'thumb_1.jpg')
|
83
|
|
-
|
84
|
|
- html = """
|
85
|
|
- <div>
|
86
|
|
- <div class="dg_u">
|
87
|
|
- <a class="dv_i" href="https://url.com/1">
|
88
|
|
- <div class="vthblock">
|
89
|
|
- <div class="vthumb">
|
90
|
|
- <img src="thumb_1.jpg" />
|
91
|
|
- </div>
|
92
|
|
- <div>
|
93
|
|
- <div class="tl">
|
94
|
|
- Title 1
|
95
|
|
- </div>
|
96
|
|
- </div>
|
97
|
|
- </div>
|
98
|
|
- <div class="videoInfoPanel">
|
99
|
|
- <div class="pubInfo">
|
100
|
|
- <div>Content 1</div>
|
101
|
|
- </div>
|
102
|
|
- </div>
|
103
|
|
- </a>
|
104
|
|
- </div>
|
105
|
|
- <div class="dg_u">
|
106
|
|
- <a class="dv_i" href="/videos/search?abcde">
|
107
|
|
- <div class="vthblock">
|
108
|
|
- <div class="vthumb">
|
109
|
|
- <img src="thumb_2.jpg" />
|
110
|
|
- </div>
|
111
|
|
- <div>
|
112
|
|
- <div class="tl">
|
113
|
|
- Title 2
|
|
70
|
+ <div class="mc_vtvc_meta">
|
|
71
|
+ <div class="mc_vtvc_title" title="Title 1"></div>
|
|
72
|
+ <div class="mc_vtvc_meta_block_area">
|
|
73
|
+ <div class="mc_vtvc_meta_block">
|
|
74
|
+ <div class="mc_vtvc_meta_row">
|
|
75
|
+ <span>65,696,000+ views</span>
|
|
76
|
+ <span>1 year ago</span>
|
114
|
77
|
</div>
|
|
78
|
+ <div class="mc_vtvc_meta_row mc_vtvc_meta_row_channel">Content 1</div>
|
|
79
|
+ <div class="mc_vtvc_meta_row"><span>
|
|
80
|
+ <div class="cico mc_vtvc_src_ico">
|
|
81
|
+ <div></div>
|
|
82
|
+ </div>
|
|
83
|
+ <span>YouTube</span>
|
|
84
|
+ </span></div>
|
115
|
85
|
</div>
|
116
|
|
- </div>
|
117
|
|
- <div class="videoInfoPanel">
|
118
|
|
- <div class="pubInfo">
|
119
|
|
- <div>Content 2</div>
|
120
|
86
|
</div>
|
121
|
87
|
</div>
|
122
|
|
- </a>
|
|
88
|
+ <div class="vrhdata"></div>
|
|
89
|
+ </a>
|
|
90
|
+ </div>
|
123
|
91
|
</div>
|
124
|
|
- </div>
|
125
|
92
|
"""
|
126
|
93
|
response = mock.Mock(text=html)
|
127
|
94
|
results = bing_videos.response(response)
|
128
|
95
|
self.assertEqual(type(results), list)
|
129
|
96
|
self.assertEqual(len(results), 1)
|
130
|
97
|
self.assertEqual(results[0]['title'], 'Title 1')
|
131
|
|
- self.assertEqual(results[0]['url'], 'https://url.com/1')
|
|
98
|
+ self.assertEqual(results[0]['url'], 'https://bing.com/video')
|
132
|
99
|
self.assertEqual(results[0]['content'], 'Content 1')
|
133
|
100
|
self.assertEqual(results[0]['thumbnail'], 'thumb_1.jpg')
|