最新要闻

广告

手机

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

家电

统计B站番剧真实评分

来源:博客园


(相关资料图)

统计B站番剧真实评分

智子封锁

近期出现B站某原创番剧的评分被智子封锁的现象,有大能者写出下面代码可以通过对短评与长评的完全统计来实现对番剧评分的真实面貌还原。

进入番剧详情页,F12打开控制台,将代码复制到控制台,回车运行。

经测试代码的泛用性还是很强的可以适用于所有番剧。

例子:

1.原创番剧《三体》统计后:

2.《我的三体之罗辑传》

统计后:

3.《我的三体之章北海传》统计后:

4.评分天花板 《兽娘动物园2》

统计后:

代码如下:

const allScore = []let totalCount = {    short: 0,    long: 0,}let render = nulllet rmDialog = nulllet midtry {    mid =  location.href.match(/media\/md(\d+)/)[1]} catch (_) {    _;}if (!mid) { throw new Error("未进入介绍详情页面") }async function getScore(next, type) {    let url = `https://api.bilibili.com/pgc/review/${type}/list?media_id=${mid}&ps=12575&sort=0`    if (next) {        url += `&cursor=${next}`    }    const res = await fetch(url, { "method": "GET" });    const { data } = await res.json()    if (totalCount[type] == 0) {        totalCount[type] = data.total    }    return data}async function scoreMain(type) {    let { list, next } = await getScore(undefined, type)    handlerList(list)    while (true) {        const data = await getScore(next, type)        handlerList(data.list)        render(type)        next = data.next        if (next == 0) {            return        }    }}function average() {    const total = allScore.reduce((p, v) => {        return p + v    }, 0)    const s = total / allScore.length    const sf = s.toFixed(3)    document.getElementsByClassName("media-info-score-content")[0].innerText = sf    const starLc = parseInt(Math.round(sf / 2))    const starHc = 5 - starLc    const starsDom = document.getElementsByClassName("review-stars")[0]    starsDom.innerHTML = ""    for (let i = 0; i < starLc; i++) {        const star = document.createElement("i")        star.className = "icon-star icon-star-light"        starsDom.appendChild(star)    }    for (let i = 0; i < starHc; i++) {        const star = document.createElement("i")        star.className = "icon-star icon-star-half"        starsDom.appendChild(star)    }    console.log("平均分:", sf)}function handlerList(list) {    allScore.push(...list.map(item => item.score))}function beforeRender() {    const dialog = document.createElement("div")    document.body.appendChild(dialog)    dialog.style.position = "fixed"    dialog.style.width = "100%"    dialog.style.height = "100%"    dialog.style.background = "rgba(0,0,0,.8)"    dialog.style.top = "0"    dialog.style.left = "0"    dialog.style.zIndex = "999"    dialog.style.display = "flex"    dialog.style.alignItems = "center"    dialog.style.justifyContent = "center"    const dialogContent = document.createElement("div")    dialog.appendChild(dialogContent)    dialogContent.style.width = "455px"    dialogContent.style.height = "200px"    dialogContent.style.background = "#fff"    dialogContent.style.borderRadius = "6px"    dialogContent.style.padding = "51px 0"    const shortWrap = document.createElement("div")    dialogContent.appendChild(shortWrap)    const longWrap = document.createElement("div")    dialogContent.appendChild(longWrap)    shortWrap.style.width = longWrap.style.width = "455px"    shortWrap.style.height = longWrap.style.height = "100px"    shortWrap.style.display = longWrap.style.display = "flex"    shortWrap.style.alignItems = longWrap.style.alignItems = "center"    shortWrap.style.justifyContent = longWrap.style.justifyContent = "center"    // --------------    const shortw1 = document.createElement("div")    const longw1 = document.createElement("div")    shortWrap.appendChild(shortw1)    longWrap.appendChild(longw1)    shortw1.innerText = "短评:"    longw1.innerText = "长评:"    longw1.style.fontSize = shortw1.style.fontSize = "14px"    longw1.style.color = shortw1.style.color = "#333"    longw1.style.marginRight = shortw1.style.marginRight = "16px"    const shortw2 = document.createElement("div")    const longw2 = document.createElement("div")    shortWrap.appendChild(shortw2)    longWrap.appendChild(longw2)    longw2.style.width = shortw2.style.width = "300px"    longw2.style.height = shortw2.style.height = "32px"    longw2.style.background = shortw2.style.background = "#eee"    longw2.style.position = shortw2.style.position = "relative"    const shortPrg = document.createElement("div")    const longPrg = document.createElement("div")    shortw2.appendChild(shortPrg)    longw2.appendChild(longPrg)    longPrg.style.position = shortPrg.style.position = "absolute"    longPrg.style.left = shortPrg.style.left = "0"    longPrg.style.top = shortPrg.style.top = "0"    longPrg.style.width = shortPrg.style.width = "0%"    longPrg.style.height = shortPrg.style.height = "100%"    longPrg.style.background = shortPrg.style.background = "#ff85ad"    render = function (type) {        const dom = type == "long" ? longPrg : shortPrg        let width;        if (type == "long") {            width = ((allScore.length - totalCount.short) * 100 / totalCount.long) + "%"        } else {            width = (allScore.length * 100 / totalCount.short) + "%"        }        dom.style.width = width    }    rmDialog = function () {        document.body.removeChild(dialog)    }}async function main() {    beforeRender()    console.log("--统计短评");    await scoreMain("short")    console.log("--统计长评");    await scoreMain("long")    average()    rmDialog()}main()

代码转自https://wdhhh.cn/home?article=627侵删

关键词: 我的三体