הטמעת Discourse-embed-bilibili (הוספת וידאו מ-bilibili ל-Discourse)

סיכום מבוסס בינה מלאכותית

The discussion revolves around a Discourse plugin called discourse-embed-bilibili, which allows users to embed Bilibili videos in their Discourse site. The plugin was originally found on GitHub, but the author’s identity was unknown until whitewaterdeu discovered it to be https://github.com/elcbng/discourse-onebox-bilibili.

whitewaterdeu shared the plugin and provided instructions on how to use it. However, Canapin pointed out some issues, including the inability to disable the plugin and the need to add https://player.bilibili.com to the allowed iframes site setting. whitewaterdeu acknowledged these issues and sought help in resolving them.

Lhc_fl offered to help whitewaterdeu add a config to disable the plugin and provided an example of how to do so. whitewaterdeu attempted to modify the config but encountered difficulties. Lhc_fl then submitted a pull request to fix the issue.

The discussion also touches on the topic of video quality, with zengyunsi commenting that the embedded videos are not clear. whitewaterdeu explained that Bilibili has restricted the clarity of embedded videos.

Rick_Jing reported that the plugin no longer works due to changes in Bilibili’s iframe requirements. whitewaterdeu acknowledged this limitation and encouraged users to submit pull requests to improve the plugin.

The discussion concludes with joo asking if the plugin still works, and scavin sharing a link to a maintained version of the plugin.

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 לייקים

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 לייקים

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 לייקים

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 לייקים

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 Customization > Plugin :slight_smile:

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

2 לייקים

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 לייקים

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

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

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