Discourse-embed-bilibili(在discourse中插入哔哩哔哩视频)

AI 生成的摘要

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

如何使用本插件

在discourse中黏贴b站视频链接即可,如

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

插件会自动将链接解析成视频 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 个赞

您好,感谢分享 :slight_smile:

我快速看了一下,有几点说明:

  • 您无法禁用插件。没有为此设置(输入被禁用)。
    image
    要禁用插件,您需要卸载它。

  • 您需要在允许的 iframe 站点设置中添加 https://player.bilibili.com。

  • Bilibili 视频在 iframe 中会自动播放 (:warning:)。

该插件可以改进。

3 个赞

这在第一篇帖子中没有解释吗?我理解它是一个功能,所以你可以控制是获得视频 onebox 还是常规 onebox。

2 个赞

谢谢,我已从帖子中删除这些内容 :slight_smile:

我不认为这是一个功能,该插件的正则表达式只考虑 video/ 之后没有任何内容的链接,而 onebox 只是不匹配 onebox 脚本模式的链接的预期后备。

任意添加查询字符串来显示常规 onebox 将是一种奇怪的控制 URL 显示方式的方法,尽管我同意这对于此功能确实很有用,因为视频是自动播放的。

3 个赞

感谢您的回复,我只想在我的网站上嵌入 Bili 视频,将 https://player.bilibili.com 添加到 允许的 iframe 的方法 不起作用,我不知道如何解决它。

这确实是个问题,但我不知道如何添加禁用插件的功能,我只会使用它,不知道如何修改代码。

我知道怎么做,你去加个config就可以了。我等会要是有空给你提个PR。

upd:啊?这个不是你写的啊?那没办法了

这是我写的一个很简单的插件,你可以参考一下怎么加的config
Lhcfl/discourse-another-smtp (github.com)

我fork了一下,改了改正则表达式,现在也可以识别有参数的超链接了

我试着改了一下config,失败😂,每次修改再验证还得rebuild,太费时间了,等大佬有空直接pr吧🙏

我已经fork并修改了正则表达式代码,现在可以正常识别带有参数的URL了。

干得不错 :+1:

当你满意结果时,建议你申请访问 Plugin authors - Discourse Meta Customization > Plugin 中发布你的插件 :slightly_smiling_face:

https://github.com/whitewatercn/discourse-embed-bilibili/pull/1

另外写插件当然是要在开发环境下,rebuild也太麻烦了……

2 个赞

已经merge了,原来config里还要写设置的名称😂

请问怎么部署开发环境呀?

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

2 个赞

这个出来的很模糊吧··

b站前一段时间限制了站外嵌入视频的清晰度,详见
https://www.zhihu.com/question/363423550

西瓜视频的外链比较好·

1 个赞

原插件作者
https://github.com/elcbng/discourse-onebox-bilibili

试了下不能用,现在bilibili iframe 里面必须要有cid,aid了吗?还有没有方法能实现嵌入呢?

这个插件只会匹配bv号,其他内容会自动忽略,更多需要可以提交pr,菜鸟只能做到这样了

关于cid我查到一些资料,也许能帮助到你

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

1 个赞

你好,这个现在还能用吗?好像不行了