Skip to content

Commit a171e23

Browse files
committed
Support Bilibili bv ID, av ID
1 parent f31b60d commit a171e23

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

classes/VideoService.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,32 @@ class VideoService {
6565
'#^([\d\w\-\+]+)$#is'
6666
]
6767
],
68+
'bilibili' => [
69+
'embed' => '<iframe title="%4$s" src="//player.bilibili.com/player.html?bvid=BV%1$s" width="%2$d" height="%3$d" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>',
70+
'default_width' => 640,
71+
'default_ratio' => 1.77777777777778, // (16 / 9)
72+
'https_enabled' => true,
73+
'url_regex' => [
74+
'#player\.bilibili\.com\/player\.html\?(?:(?:[a-zA-Z0-9=&]*&)?)bvid=[bB][vV]([a-zA-Z0-9]+)#is',
75+
'#www\.bilibili\.com\/video\/[bB][vV]([a-zA-Z0-9]+)#is'
76+
],
77+
'id_regex' => [
78+
'#^(?:[bB][vV])?([a-zA-Z0-9]+)$#is'
79+
]
80+
],
81+
'bilibili_aid' => [
82+
'embed' => '<iframe title="%4$s" src="//player.bilibili.com/player.html?aid=%1$s" width="%2$d" height="%3$d" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>',
83+
'default_width' => 640,
84+
'default_ratio' => 1.77777777777778, // (16 / 9)
85+
'https_enabled' => true,
86+
'url_regex' => [
87+
'#player\.bilibili\.com\/player\.html\?(?:(?:[a-zA-Z0-9=&]*&)?)aid=([1-9][\d]+)#is',
88+
'#www\.bilibili\.com\/video\/[aA][vV]([1-9][\d]+)#is'
89+
],
90+
'id_regex' => [
91+
'#^(?:[aA][vV])?([1-9][\d]*)$#is'
92+
]
93+
],
6894
'bing' => [
6995
'embed' => '<iframe title="%4$s" src="//hub.video.msn.com/embed/%1$s" width="%2$d" height="%3$d" frameborder="0" scrolling="no" noscroll allowfullscreen="true"></iframe>',
7096
'default_width' => 640,
@@ -518,6 +544,8 @@ class VideoService {
518544
'archive.org' => 'archiveorg',
519545
'embed.bambuser.com' => ['bambuser', 'bambuser_channel'],
520546
'beam.pro' => 'beam',
547+
'bilibili.com' => ['bilibili', 'bilibili_aid'],
548+
'hdslb.com' => ['bilibili', 'bilibili_aid'],
521549
'bing.com' => 'bing',
522550
'blip.tv' => 'blip',
523551
'collegehumor.com' => 'collegehumor',

0 commit comments

Comments
 (0)