Greasy Fork

Greasy Fork is available in English.

Give me AV not BV

F**king Bilibili, give my av number back!

当前为 2020-03-23 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Give me AV not BV
// @namespace    https://xsky123.com
// @version      0.1
// @description  F**king Bilibili, give my av number back!
// @author       XSky123
// @require      https://unpkg.com/[email protected]/dist/ajaxhook.min.js
// @match        https://www.bilibili.com/video/*
// @match        https://acg.tv/*
// @match        https://b23.tv/*
// @grant        none
// ==/UserScript==

if(window.location.href.match(/.*bilibili.com\/video\/BV.*/)){
    var url = "https://www.bilibili.com/video/av"+window.__INITIAL_STATE__.aid;
    window.location.href=url;
    console.log("F**k You BV Number!");
}
var is_finished_ajax = false;
var is_av_number_written = false;
ah.proxy({
    //请求发起前进入
    onRequest: (config, handler) => {
        if(config.url.indexOf("first_video_frame_decoded")!=-1){
        //console.log(config.url)
            is_finished_ajax = true;
        }
        handler.next(config);
    },

    //请求成功后进入
    onResponse: (response, handler) => {
        //console.log(response.response)
        if(is_finished_ajax && !is_av_number_written){
            document.getElementsByClassName("video-data")[0].innerHTML += "&nbsp;&nbsp;&nbsp;&nbsp;<span>av"+window.__INITIAL_STATE__.aid+"</span>";
            is_av_number_written = true;
        }
        handler.next(response)
    }
})