-
Notifications
You must be signed in to change notification settings - Fork 0
/
zhoushuyi.js
264 lines (242 loc) · 18.4 KB
/
zhoushuyi.js
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
// ==UserScript==
// @name B站 周姐
// @namespace https://space.bilibili.com/15516023
// @version 1.6
// @description B站首页看周姐!
// @author You
// @match https://www.bilibili.com/
// @icon https://www.google.com/s2/favicons?domain=bilibili.com
// @grant GM_addStyle
// @license MIT
// ==/UserScript==
;(function () {
'use strict'
GM_addStyle(`
#bili_zhoushuyi .popover-video-card {
display: none;
}
#bili_zhoushuyi a:hover+.popover-video-card {
display: block;
}
`)
const TITLE = '周姐'
const KEY_WORDS = '周淑怡'
const CHANNEL_ID = 780447
const ICON =
'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBYWFRgWFhYYGRgZGhoeHBwaGhweHBoaHBoeGhwcGBgcIS4lHB4rIRoYJjgmKy8xNTU1GiQ7QDs0Py40NTEBDAwMEA8QHhISHjQrJCsxNDQ0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N0Go3H1Cva9d7DoXt35jw3C4+qyo2xBRpr0xpTXaMKKt9Ve8CpurPyt7yeQkffgqvE8LcK+QfC4jKeh28NF6PwPhDKFPKLWlzt3E80vgn7H5OTJ6JAxtNnQeZ/dVj3lxk/fRPx2JzugfCLDr1TGNR3Xi9EUsWv2OaxTsamtClaqyBk1Nkq2pYFoFxJQPD2y4eauUzI02uimxuAy9punzCzfFsPYvaLj4h/u+q3VZoLSDyWcxNKZ8fHYgrPyz1qLcNt+zO4DGGYiQNVfYaoLA+H+U/RZNwNKq5mg1b3E/porzD1JFtVnXRelpeZ6nIeYSVd/Hn7AXE3kJ4l0mrhXYWogdCcCmLoRRxIAmvpuOgJUuHoknoj2tgQEwjrCpZh3AiWlAvb23zs53yJWlWXDiXOcdSSfPVT5OkPx06ZMQonPhK5MLvu0svV2VZA5z3bgDoEmYUamSeZv/ZEhqZWxLGakLn4rs5NvpHQyE17mhRe8e7QZR118tl1tL71XJthxIgxFdk3cJ5SqjF9h3vGafiH+4deau30wgcXQABI/unpJz7Ol5RBh3tc9jjctIIPLmr3HYzs5W769Aspw2gQXm5a0/YVzTJOuqjVNJIapTe/okYxTtakwKZrU0iMTQntC6GKRrVRUAKwNrqzDwqhhhStqFN5IlU6ywxD+yVTVAiqlWRCGeElvRonEZX2rwpytqt1Yb/yn94UeAryAVosZRDmlp0IIPisbg5Y5zHatJCytfDSu0aD3gXEDmSS9jeJsQnhJJbjIzhXWJJIgD8Lop0kkSL9javwu7j6LLs0SSUuX0W4fpLR1Uj0kkklWR1N1RM/6lvc70XEkL+Dcf0vGp6SSoxCFyAx3wnuSSSv+oy/sc4d8Dv5negTqSSSnfwf6w1qmYupJ16EJGqRJJMhWOCeVxJEBxMKSSVhQNXWQ4h/1LvD0SSUX7LT6JUkkko5/9k='
let currentPage = 1
let page = 0
let videoList = []
async function getDetail(bvid) {
let res = await fetch(
`https://api.bilibili.com/x/web-interface/archive/stat?bvid=${bvid}`,
)
return (await res.json()).data
}
async function getNewVideo() {
let res = await fetch(
`https://api.bilibili.com/x/web-interface/search/type?context=&order=pubdate&keyword=${KEY_WORDS}&search_type=video&page=${currentPage++}`,
)
videoList = videoList.concat((await res.json()).data.result)
}
async function getHotVideo() {
let res = await fetch(
`https://api.bilibili.com/x/web-interface/web/channel/multiple/list?channel_id=${CHANNEL_ID}&sort_type=hot&offset=&page_size=8`,
)
return (await res.json()).data.list[0].items
}
function bigNumber(num) {
return num > 10000 ? `${(num / 10000).toFixed(2)}万` : num
}
function s2d(string) {
return new DOMParser().parseFromString(string, 'text/html').body
.childNodes[0]
}
async function refresh() {
page++
if (videoList.length < page * 8 + 8) {
await getNewVideo()
}
drawVideos()
}
function timeFormat(time) {
let res = []
let [s = 0, m = 0, h = 0] = time.split(':').reverse()
res.unshift(String(s).padStart(2, '0'))
res.unshift(String(m % 60).padStart(2, '0'))
res.unshift(String(h % 60).padStart(2, '0'))
return res.join(':')
}
function drawVideos() {
const VIDEO_DOM = document.querySelector('#bili_zhoushuyi .zone-list-box')
VIDEO_DOM.innerHTML = ''
videoList.slice(page * 8, page * 8 + 8).forEach((item) => {
let title = item.title.replace(/<em class="keyword">(.*?)<\/em>/g, '$1')
let DOM = s2d(`
<div class="video-card-common">
<div class="card-pic card-pic-hover"><a href="//www.bilibili.com/video/${
item.bvid
}" target="_blank"><img
src="${item.pic}"
alt="">
<div class="count">
<div class="left"><span><i class="bilifont bili-icon_shipin_bofangshu"></i>
${item.play}
</span><span><i class="bilifont bili-icon_shipin_dianzanshu"></i>${
item.favorites
}</span></div>
<div class="right"><span>${timeFormat(item.duration)}</span></div>
</div><i class="crown"></i>
</a>
<div class="watch-later-video van-watchlater black"><span class="wl-tips" style="display: none;"></span>
</div>
</div><a href="//www.bilibili.com/video/${
item.bvid
}" target="_blank" title="${title}"
class="title">
${title}
</a><a href="//space.bilibili.com/${
item.mid
}/" target="_blank" class="up"><i
class="bilifont bili-icon_xinxi_UPzhu"></i>${item.author}
</a>
</div>`)
VIDEO_DOM.append(DOM)
})
}
async function drawFirst(item) {
const RANK_DOM = document.querySelector('#bili_zhoushuyi .rank-list')
let firstDetail = await getDetail(item.bvid)
let firstTitle = item.name.replace(/<em class="keyword">(.*?)<\/em>/g, '$1')
let first = `
<div class="rank-wrap"><span class="number on">1</span>
<div class="preview">
<div class="pic">
<a href="//www.bilibili.com/video/${
item.bvid
}" target="_blank" class="link">
<img src="${item.cover}" alt="${firstTitle}">
</a>
<div class="watch-later-video van-watchlater black"><span class="wl-tips" style="display: none;"></span>
</div>
</div>
<div class="txt"><a href="//www.bilibili.com/video/${
item.bvid
}" target="_blank" class="link">
<p title="${firstTitle}">${firstTitle}</p>
</a><span>播放次数:${bigNumber(firstDetail.view)}</span></div>
</div>
<div class="popover-video-card pvc" style="display: none;">
<div class="content"><img src="${item.cover}" alt="">
<div class="info">
<p class="f-title">${firstTitle}</p>
<p class="subtitle"><span class="name">${item.author_name}</span>
<span class="point">·</span><span class="time">2021-11-22</span></p>
</div>
</div>
<div class="count">
<ul>
<li><i class="bilifont bili-icon_shipin_bofangshu"></i><span>${bigNumber(
firstDetail.view,
)}</span></li>
<li><i class="bilifont bili-icon_shipin_danmushu"></i><span>${bigNumber(
firstDetail.danmaku,
)}</span></li>
<li><i class="bilifont bili-icon_shipin_shoucangshu"></i><span>${bigNumber(
firstDetail.favorite,
)}</span></li>
<li><i class="bilifont bili-icon_shipin_yingbishu"></i><span>${bigNumber(
firstDetail.coin,
)}</span></li>
</ul>
</div>
</div>
</div>
`
RANK_DOM.append(s2d(first))
}
async function drawHot() {
const RANK_DOM = document.querySelector('#bili_zhoushuyi .rank-list')
let rankList = await getHotVideo()
await drawFirst(rankList.shift())
console.log(`[rankList[0]:`, rankList[0])
rankList.forEach((item, index) => {
let title = item.name.replace(/<em class="keyword">(.*?)<\/em>/g, '$1')
let DOM = s2d(`
<div class="rank-wrap"><span class="number ${index < 2 && 'on'}">${
index + 2
}</span>
<a href="//www.bilibili.com/video/${
item.bvid
}" target="_blank" class="link">
<p title="${title}" class="title">${title}</p>
</a>
<div class="popover-video-card pvc">
<div class="content"><img
src="${item.cover}" alt="">
<div class="info">
<p class="f-title">${title}</p>
<p class="subtitle"><span class="name">${
item.author_name
}</span><span class="point">·</span><span
class="time">${timeFormat(item.duration)}</span></p>
</div>
</div>
<div class="count">
<ul>
<li><i class="bilifont bili-icon_shipin_bofangshu"></i><span>${
item.view_count
}</span></li>
<li><i class="bilifont bili-icon_shipin_danmushu"></i><span>-</span></li>
<li><i class="bilifont bili-icon_shipin_shoucangshu"></i><span>-</span></li>
<li><i class="bilifont bili-icon_shipin_yingbishu"></i><span>-</span></li>
</ul>
</div>
</div>
</div>`)
RANK_DOM.append(DOM)
})
}
const zhoujieDOM = `
<div id="bili_zhoushuyi">
<div class="space-between report-wrap-module report-scroll-module" id="bili_report_douga" scrollshow="true">
<div class="card-list">
<header class="storey-title">
<div class="l-con"> <img class="svg-icon" src="${ICON}" /> <a
href="https://search.bilibili.com/all?keyword=${KEY_WORDS}" target="_blank" class="name">${TITLE}</a></div>
<div class="exchange-btn">
<div class="btn btn-change zhoujie-refresh"><i class="bilifont bili-icon_caozuo_huanyihuan"></i> 换一换 </div><a
href="https://search.bilibili.com/all?keyword=${KEY_WORDS}&order=pubdate" target="_blank" class="btn more">
更多 <i class="bilifont bili-icon_caozuo_qianwang"></i></a>
</div>
</header>
<div class="zone-list-box"> </div>
</div>
<div class="rank-list">
<header class="rank-header"><span class="name">排行榜</span><a
href="https://www.bilibili.com/v/channel/${CHANNEL_ID}?tab=multiple" target="_blank" class="more">更多<i
class="bilifont bili-icon_caozuo_qianwang"></i></a></header>
</div>
</div>
</div>`
window.addEventListener(
'load',
async function () {
let content = document.querySelector('.first-screen')
let anchor = document.querySelector('#reportFirst2')
let init = s2d(zhoujieDOM)
// 插入初始模版
content.insertBefore(init, anchor)
//点击事件
document
.querySelector('.zhoujie-refresh')
.addEventListener('click', refresh)
// 插入最新视频
await getNewVideo()
drawVideos()
// 插入热门视频
drawHot()
},
false,
)
})()