# 一个可以将用户附加到 Discourse 帖子的视频上传到我公司 YouTube 频道的插件

**URL:** <https://meta.discourse.org/t/a-plug-in-that-would-upload-a-video-which-a-user-had-attached-to-a-discourse-posting-to-my-company-s-youtube-channel/291477>\
**Category:** Feature\
**Created:** [2024年一月12日 20:14 UTC](https://meta.discourse.org/t/a-plug-in-that-would-upload-a-video-which-a-user-had-attached-to-a-discourse-posting-to-my-company-s-youtube-channel/291477 "2024-01-12T20:14:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Feronti](https://avatars.discourse-cdn.com/v4/letter/f/94ad74/32.png) [@Feronti](https://meta.discourse.org/u/Feronti)\
**Post date:** [2024年一月12日 20:14 UTC](https://meta.discourse.org/t/a-plug-in-that-would-upload-a-video-which-a-user-had-attached-to-a-discourse-posting-to-my-company-s-youtube-channel/291477/1 "2024-01-12T20:14:54Z")

</div>

我读到……

> [@SaraDev](#):
>
> 如果您经常共享许多文件或非常大的文件，我们建议您使用 Google Drive、Dropbox 或其他云文件共享服务。您还可以使用 YouTube 或 SoundCloud 等流媒体服务来托管大型媒体文件。然后，您可以从那里获取链接并将其粘贴到您的帖子中。将链接放在单独一行上，周围留有空行，以便在支持的情况下显示文件中的媒体播放器或摘要预览。

这大概是可行的。

**我的用例**

1. 因为我不想让我的用户费事地进行额外的步骤来将视频上传到 YouTube，然后再将该 YouTube 链接复制并粘贴到他们的 Discourse 帖子中，并且
2. 因为我希望他们附加到 Discourse 帖子的视频上传到我公司的 YouTube 频道，

**我想要的功能**

1. 假设用户已将视频文件附加到他们在 Discourse 上创建的帖子中，
2. 该文件将被以编程方式上传到我公司的 YouTube 频道（可能使用 YouTube Data API），然后
3. 该视频（用户已附加到其 Discourse 帖子中的视频）将被以编程方式删除，并替换为指向 YouTube 文件的链接，显示为缩略图。

**额外信息 1**

我知道我可以编写一个 Python 脚本，将位于 `/var/discourse/shared/standalone/uploads/default/` 的视频上传到我公司的 YouTube 帐户。

但是，我不想弄清楚如何从用户的 Discourse 帖子中删除附件，并同时将 YouTube 文件的链接插入到用户的 Discourse 帖子中。

**额外信息 2**

如果您好奇的话，我设想有些用户可能会发布大于 10GB（十千兆字节）的视频。

**额外信息 3**

我读到……

> [@SaraDev](#):
>
> Discourse 不提供文件管理界面。要删除文件，请删除包含它们的帖子，或编辑帖子以删除附件链接。孤立的文件将在 48 小时的宽限期后自动删除。

**额外信息 4**

我还读到……

> [@Arkshine](#):
>
> 仅预加载元数据并不总是被浏览器尊重，有时整个视频都会被下载。这会切换到使用占位符图像来播放视频，并且仅在点击播放按钮时才加载视频。

---

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [2024年一月12日 20:17 UTC](https://meta.discourse.org/t/a-plug-in-that-would-upload-a-video-which-a-user-had-attached-to-a-discourse-posting-to-my-company-s-youtube-channel/291477/2 "2024-01-12T20:17:24Z")

</div>

有一个主题组件，我认为它能完全满足您的需求，尽管我知道它目前已无人维护

> [@Video Upload to YouTube and Vimeo using Theme Component](https://meta.discourse.org/t/video-upload-to-youtube-and-vimeo-using-theme-component/170079/):
>
> This new theme component enables video uploads from the Discourse composer to YouTube and Vimeo. For those already familiar with [the plugin I developed recently](https://meta.discourse.org/t/discourse-video-upload-plugin-with-youtube-and-vimeo/168569), the same is now available in this Theme Component which can be added to any theme. This makes for a much easier installation and works in exactly the same way as the plugin. Features All forum members can upload videos to Vimeo or YouTube (admins can choose to enable either or both). Admins can control the view and embed privacy of th…

---

<div class="post-metadata">

**Author:** ![Feronti](https://avatars.discourse-cdn.com/v4/letter/f/94ad74/32.png) [@Feronti](https://meta.discourse.org/u/Feronti)\
**Post date:** [2024年一月12日 20:23 UTC](https://meta.discourse.org/t/a-plug-in-that-would-upload-a-video-which-a-user-had-attached-to-a-discourse-posting-to-my-company-s-youtube-channel/291477/3 "2024-01-12T20:23:04Z")

</div>

Apparently it is broken and unmaintained.

> [@Canapin](#):
>
> > [@Octoberon](#):
> >
> > Is that still an issue that breaks Youtube API use?
> 
> I have contacted the author who has no time to spend on the component. Until further notice, the component is tagged as #unmaintained.
