The following is the replay of Wei Xiaowei's live broadcast on Yizhibo on October 19th (Mi Mei face, the barrage was successfully extracted and converted into a format recognizable by DPlayer).
Sometimes the video may stutter due to the live broadcast; a total of 15,768 barrages and a 1.7 MB barrage file, with the first barrage appearing at 13 seconds.
The Yizhibo barrage pool and DPlayer barrage pool do not affect each other, and you can also send barrages below.
Video and Barrage Transfer#
The next day of the live broadcast, I found that Yizhibo had the replay from yesterday, and I was so happy that I fainted. After waking up, I started to figure out how to download the video and barrage.
Video#
I couldn't find a tool to download Yizhibo videos online, so I had to do it myself. I saw that a m3u8 file was loaded on the page through the browser developer tools, and then I just needed to download the 354 video segments in the m3u8 file.
I wrote a shell script for batch downloading:
#!/bin/bash
for k in $( seq 1 354 )
do
wget http://xxx/${k}.ts
done
DPlayer has long supported the m3u8 format, so no further processing is needed for the video segments.
Video download completed.
Barrage#
I used the developer tools to capture the request pattern for the barrage file.
The first barrage segment is http://xxx?ts=1, and the other barrage segments only have different ts parameters. The pattern of the ts parameter is as follows: the parameter of the next segment is the last ts value in the return value of the previous segment.
Knowing the pattern, I wrote a JavaScript script to download the barrage and convert it to DPlayer's format.
function ajaxDan(ts) {
$.ajax({
url: `http://xxx?ts=${ts}`,
success: function (data) {
var tli = parseInt(data.data.list[data.data.list.length - 1].ts)+1;
console.log(tli);
data.data.list.map(function (i) {
dan[index] = {
author: "yizhibon" + i.nickname,
time: parseInt(i.ts) / 1000,
text: i.content,
color: '#fff',
type: 'right'
}
index++;
});
ajaxDan(tli)}
})
}
var dan = [];
var index = 0;
ajaxDan(1);
Result: 536 video segments, 15,768 barrages
Then stringify the barrage object and copy it to a JSON file.
Completed.