Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bilibili Service: New Player URL #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
--[[
Cinema Modded Bilibili Support
Powered by OriginalSnow

You can edit this code.But you cant upload anymore.
]]
-- Last update : 2023/8/4
local SERVICE = {}
SERVICE.Name = "哔哩哔哩" -- 服务名称
SERVICE.IsTimed = true -- 是否是计时视频
SERVICE.Name = "哔哩哔哩"
SERVICE.IsTimed = true
SERVICE.Dependency = DEPENDENCY_COMPLETE
-- 目前支持AV号与BV号
local META_URL = "https://www.bilibili.com/video/%s"
function SERVICE:Match(url) -- 匹配B站网址
local bv = url.host:match("www.bilibili.com") and string.match(url.path, "BV[%w*]+")
Expand All @@ -18,28 +10,33 @@ function SERVICE:Match(url) -- 匹配B站网址
end

if CLIENT then
local PLAYURL = "www.bilibili.com/blackboard/html5mobileplayer.html?bvid=%s&autoplay=1&p=%s"
local PLAYURL = "https://www.bilibili.com/blackboard/newplayer.html?bvid=%s&page=%s&autoplay=1&t=0.1"
local JS = [[
var Checked = false
var checkerInterval = setInterval(function() {
var player = document.getElementsByTagName('video')[0];
if (!!player && player.paused == false && player.readyState == 4) {
if (!!player && player.paused == false && player.readyState == 4 && !Checked) {
Checked = true
clearInterval(checkerInterval);

document.body.style.backgroundColor = "black";
window.cinema_controller = player;

exTheater.controllerReady();
}
}, 50);
setInterval(function(){
document.getElementsByClassName("bpx-player-top-wrap")[0].hidden = true
document.getElementsByClassName("bpx-player-control-wrap")[0].hidden = true
document.getElementsByClassName("bpx-player-relation-button")[0].style.opacity = 0
}, 1000)
]]
function SERVICE:LoadProvider(vi, p)
local vedioID = vi:Data()
local vid = string.Split(vedioID, " ")
p:OpenURL(PLAYURL:format(vid[1], vid[2]))
p.OnDocumentReady = function(pnl)
self:LoadExFunctions(pnl)
pnl:QueueJavascript(JS)
end
self:LoadExFunctions(pnl)
pnl:QueueJavascript(JS)
end
end
end

Expand All @@ -51,9 +48,10 @@ function SERVICE:GetURLInfo(url)
else
bp = 1
end

if url.host:match("www.bilibili.com") or url.host:match("b23.tv") then info.Data = string.match(url.path, "BV[%w*]+") .. " " .. bp end
return info.Data and info or false
if url.host:match("www.bilibili.com") or url.host:match("b23.tv") then
info.Data = string.match(url.path,"BV[%w*]+").." "..bp
end
return info.Data and info or false
end

function SERVICE:GetVideoInfo(d, onSuccess, onFailure)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
--[[
Cinema Modded Bilibili Legacy Support
Powered by OriginalSnow

You can edit this code.But you cant upload anymore.
]]
-- Last update : 2023/8/4
local SERVICE = {}
SERVICE.Name = "哔哩哔哩Legacy"
SERVICE.IsTimed = true
Expand All @@ -14,31 +7,35 @@ function SERVICE:Match(url)
local av = url.host:match("www.bilibili.com") and string.match(url.path, "av[%w*]+")
return av or b23 or false
end

if CLIENT then
local PLAYURL = "www.bilibili.com/blackboard/html5mobileplayer.html?aid=%s&autoplay=1&p=%s"
local PLAYURL = "https://www.bilibili.com/blackboard/newplayer.html?aid=%s&page=%s&autoplay=1&t=0.1"
local JS = [[
var Checked = false
var checkerInterval = setInterval(function() {
var player = document.getElementsByTagName('video')[0];
if (!!player && player.paused == false && player.readyState == 4) {
if (!!player && player.paused == false && player.readyState == 4 && !Checked) {
Checked = true
clearInterval(checkerInterval);

document.body.style.backgroundColor = "black";
window.cinema_controller = player;

exTheater.controllerReady();
}
}, 50);
setInterval(function(){
document.getElementsByClassName("bpx-player-top-wrap")[0].hidden = true
document.getElementsByClassName("bpx-player-control-wrap")[0].hidden = true
document.getElementsByClassName("bpx-player-relation-button")[0].style.opacity = 0
}, 1000)
]]
function SERVICE:LoadProvider(vi, p)
local vedioID = vi:Data()
local vid = string.Split(vedioID, " ")
local aid = string.Split(vid[1], "av")
p:OpenURL(PLAYURL:format(aid[2], vid[2]))
p.OnDocumentReady = function(pnl)
self:LoadExFunctions(pnl)
pnl:QueueJavascript(JS)
end
self:LoadExFunctions(pnl)
pnl:QueueJavascript(JS)
end
end
end

Expand All @@ -50,9 +47,8 @@ function SERVICE:GetURLInfo(url)
else
p = 1
end

if url.host:match("www.bilibili.com") or url.host:match("b23.tv") then info.Data = string.match(url.path, "av[%w*]+") .. " " .. p end
return info.Data and info or false
if url.host:match("www.bilibili.com") or url.host:match("b23.tv") then info.Data = string.match(url.path,"av[%w*]+") .. " " .. p end
return info.Data and info or false
end

function SERVICE:GetVideoInfo(d, onSuccess, onFailure)
Expand Down