Discourse-embed-bilibili (Inserting Bilibili videos into discourse)

How to use

just paste your bilibili url, like this

https://www.bilibili.com/video/BV1294y1b7Cx
https://www.bilibili.com/video/BV1294y1b7Cx/?spm_id_from=333.788

then you embed this video successfully bili测试 - 🗣️闲聊 - 始徒Beginner

How to use this plugin

In discourse, paste the Bilibili video link, for example

https://www.bilibili.com/video/BV1294y1b7Cx
https://www.bilibili.com/video/BV1294y1b7Cx/?spm_id_from=333.788

The plugin will automatically parse the link into a video bili测试 - 🗣️闲聊 - 始徒Beginner

Thanks for the author

I found the plugin by google about how to embed bilibili in discourse and got it in github, but i don’t found anything about the author in discourse meta forum

Anyway ,thanks for your help about bilibili

6 Likes

Hi, thanks for sharing this :slight_smile:

I had a quick look at it, and have a few remarks:

  • You can’t disable the plugin. There is no setting for this (the input is disabled).
    image
    To disable the plugin, you need to uninstall it.

  • You need to add https://player.bilibili.com in the allowed iframes site setting.

  • The videos from bilibili inside iframes are autoplay (:warning:).

This plugin would benefit from improvements.

3 Likes

Isn’t that explained in the first post? I understood it as a feature, so you can control whether you get a video onebox or a regular onebox.

2 Likes

Thanks, I removed these points from my post :slight_smile:

I don’t see it as a feature, the plugin’s regex only takes into account links that don’t have anything after video/ and the onebox is just the expected fallback for links that don’t match a onebox script pattern.

Arbitrarily adding a query string to display a regular onebox would be a weird way to control how a URL is displayed, though I agree that it would definitely be useful for this since the videos are autoplay.

3 Likes

thanks for your reply, i just want to embed bili video in my site, the method of add https://player.bilibili.com in the allowed iframes doesn’t work , i don’t know how to fix it

this is indeed a problem, but i don’t know how to add the function of disable plugin, i just can use it, don’t know how to modify the code

I know how to do it, just add a config. I’ll submit a PR if I have time later.

upd: Huh? You didn’t write this? Then there’s nothing I can do.

This is a very simple plugin I wrote, you can refer to it on how to add the config.
Lhcfl/discourse-another-smtp (github.com)

I forked it, modified the regular expression, and now it can also recognize hyperlinks with parameters.

I tried to modify the config, but failed :joy:. It takes too much time to rebuild every time I modify and verify. I’ll wait for a big shot to have time to directly PR :folded_hands:.

i have fork and modify the regex code , urls with parameters are now recognized normally

Good job :+1:

When you’re happy with the result, I suggest you request access to Plugin authors - Discourse Meta and post your plugin in plugin :slight_smile:

Also, writing plugins should be done in a development environment, and rebuilding is too troublesome…

2 Likes

It has been merged. I didn’t realize I had to write the setting name in the config :joy:

How do I deploy the development environment?

https://meta.discourse.org/tags/c/documentation/devs/56/dev-install

2 Likes

This is very blurry, isn’t it?

Bilibili recently restricted the clarity of videos embedded outside the site. See details at
https://www.zhihu.com/question/363423550

Xigua Video’s external links are relatively good.

1 Like

Original plugin author

Tried it, it doesn’t work. Does bilibili iframe now require cid and aid? Are there any other ways to achieve embedding?

This plugin only matches bv IDs, and other content will be automatically ignored. For more features, you can submit a PR. This is all I can do as a beginner.

Regarding CID, I found some information that might help you:

https://www.zhihu.com/question/400156620?utm_id=0

1 Like

Hello, can this still be used? It doesn’t seem to be working.