Bilibili-aid Assistant

根据B站bv号获取av号

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Bilibili-aid Assistant
// @namespace    https://www.maxalex.tk
// @version      0.4
// @description  根据B站bv号获取av号
// @author       MaxAlex, aka zyf722
// @match        https://www.bilibili.com/video/*
// @grant        none
// @require      https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
// @license      MIT
// ==/UserScript==

// Configuration Begin

var trytime = 2500; // 等待页面加载完成时间(ms)

// Configuration End

var old_title;

setInterval( function(){

if ($(".tit").text() != old_title) {

var bid = window.location.href.split("video/")[1].split("?")[0].split("/")[0].split("BV")[1];
var cid,aid;

$.ajax({
	type: "GET",
	async: false,
	url: "https://api.bilibili.com/x/player/pagelist?bvid="+bid+"&jsonp=jsonp",
	success: function(data){
		cid = JSON.parse(JSON.stringify(data)).data[0].cid;
	}
});


$.ajax({
	type: "GET",
	async: false,
	url: "https://api.bilibili.com/x/web-interface/view?cid="+cid+"&bvid="+bid,
	success: function(data){
		aid = JSON.parse(JSON.stringify(data)).data.aid;
	}
});

$(".tit").text($(".tit").text()+" (av"+aid+")")

old_title = $(".tit").text()

}

},trytime)