Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.
myfreeer edited this page Apr 2, 2017 · 15 revisions

bilibili apis

bilihelper api

limits: rate=10

//var appkey = '95acd7f6cc3392f3';
var appkey = '0000000000000000';
//var type = "&type=mp4";
var type = "&type=flv";
var url = "http://interface.bilibili.com/playurl?platform=bilihelper&otype=json&appkey=" + appkey + "&cid=" + cid + "&quality=3" + type;
//var type = 'json';
fetch(url).then(res => res.json().then(json => callback(json)));

low-res api

limits: only low resolution available

var token = document.body.innerHTML.match(/token[ =]+[\'\"]([0-9a-f]+)[\'\"\;]+/)[1];
var page = location.href.match(/video\/av(\d+)\/index_(\d+).html/) ? "1" : location.href.match(/video\/av(\d+)\/index_(\d+).html/)[2];
var url = 'http://api.bilibili.com/playurl?&aid=' + location.href.match(/video\/av(\d+)/)[1] + '&page=' + request.pg + '&platform=html5&token=' + token;
//var type = 'json';
fetch(url).then(res => res.json().then(json => callback(json)));

Third-party apis

biliplus.com

reserve proxy: biliplus.ipcjsdev.tk

//info
//var url_info = 'https://www.biliplus.com/api/view?id=' + avid + '&update=1'
var url_info = 'https://www.biliplus.com/api/view?id=' + avid
//type:json
//can extract cids of deleted video
//same format as bilibili api
//downlink
//var url = https://www.biliplus.com/api/geturl?update=1&bangumi=0&av=2699071&page=1
var url = 'https://www.biliplus.com/api/geturl?update=1&bangumi=0&av='+avid+'&page='+page
//var type = 'json';
fetch(url).then(res => res.json().then(json => callback(json)));

//downlink(xml)
var url = 'https://www.biliplus.com/BPplayurl.php?cid='+cid+'&player=1'
//var type='xml';
//same format as bilibili api

//downlink(json)
var url = 'https://www.biliplus.com/BPplayurl.php?cid='+cid+'&player=1&otype=json';
//same format as bilibili api

kanbilibili.com

limits: only mp4 available

//info
var info_url = 'http://kanbilibili.com/api/video/'+avid;

//download
var url = 'http://www.kanbilibili.com/api/video/' + avid + '/download?cid=' + cid;
//var type = 'json';
fetch(url).then(res => res.json().then(json => callback(json)));

flvcd.com

limits: rate=80, not available for some videos

var format = "super" || "high" || "fluent";
var url = "http://www.flvcd.com/parse.php?kw=" + encodeURIComponent(location.href) + "&format=" + format
//var type = 'html';
fetch(url).then(res => res.text()).then(res => {
    let parser = new DOMParser();
    let htmlres = parser.parseFromString(res, 'text/html');
    let array = [],
        a = htmlres.getElementsByTagName('a');
    for (let i in a)
        if (a[i].href && a[i].href.match(/acgvideo\.com.+rate=[0-9]+/) && array.indexOf(a.href) < 0) array.push(a[i].href);
    return array.length > 0 ? callback(array) : callback(false);
});

DPlayer(api.prprpr.me)

limits:rate=10, only mp4 available

//note: requests with aid can get only the first page
var url = cid ? 'https://api.prprpr.me/dplayer/video/bilibili?cid=' + cid : 'https://api.prprpr.me/dplayer/video/bilibili?aid=' + avid
//directly redirect to video

bilibilijj.com

limits: sometimes may not be real urls, rate=210

//info
var info_url='http://www.bilibilijj.com/Api/AvToCid/'+avid;
//type:json
//can extract cids of deleted video

bilibilijj direct url (cid required)

//direct url (cid required)
var url = 'http://www.bilibilijj.com/Files/DownLoad/' + cid + '.mp4/www.bilibilijj.com.mp4?mp3=true';
callback(url);

bilibilijj batch method (avid required)

//batch method (avid required)
var url = 'http://www.bilibilijj.com/video/av' + avid;
//var type = 'html';
fetch(url).then(res => res.text()).then(res => {
    let parser = new DOMParser();
    let htmlres = parser.parseFromString(res, 'text/html');
    let xml = [],
        mp4 = [];
    document.querySelectorAll('a[href*=xml]').forEach(a => xml.push(a));
    document.querySelectorAll('a[href*=mp4]').forEach(a => mp4.push(a));
    xml = xml.join('\n').split('\n');
    mp4 = mp4.join('\n').split('\n').map(a => a + "/www.bilibilijj.com.mp4?mp3=true");
    if (typeof callback == "function") callback({
        'xml': xml,
        'mp4': mp4
    });
});