Remove Dropbox Onebox For Audio Links

AI 生成的摘要

The discussion revolves around the issue of Dropbox links not playing audio files within Discourse due to Dropbox’s policy of not allowing off-site streaming.

JamesNorth initially asked how to remove the onebox formatting for Dropbox audio links. Falco suggested adding ?dl=1 to the link, which may work in some cases. However, craigconstantine reported that this solution no longer works in Safari.

Falco recommended uploading files directly to Discourse or using alternative media hosting services. steveh suggested that editing the Dropbox share link to end with ?raw=1 might work, but craigconstantine reported that this solution also no longer works in Safari.

JQ331 summarized the issue and suggested that turning off oneboxing for Dropbox audio links would be the best solution, as users may not understand the technical issues.

Codinghorror suggested adding dropbox.com to the “blocked onebox domains” in the site settings, which JQ331 tested and found to be partially effective, blocking oneboxing for audio files but not for images. Simon_Manning suggested that the issue may be due to the different domains used for audio and image files.

Hi All,

The Dropbox Onebox works great generally - the pretty box with the folder/file name etc .. but with some individual files (like mp3 etc) it attempts to ‘play’ the file with the inbuilt audio player.

https://www.dropbox.com/s/5n413v2420pgslc/James%20and%20Ric%202017.mp3?dl=0

Becomes

Now, Dropbox kind of doesn’t allow that kind of off-site streaming thing - it prefers you to land on their page and play it with their audio player.

  • Is there a way to remove the onebox formatting on a link?
  • Or, can the media player not attempt to play files from the Dropbox (and probably other cloud formats?) domain(s)
5 个赞

https://www.dropbox.com/s/5n413v2420pgslc/James%20and%20Ric%202017.mp3?dl=1

dl=1 works.

It’s a very strange quirky at Dropbox side, they should use the imgur convention (with file externsion is hotlinking and without a html page).

8 个赞

Odd - good tip for now … I’ll try to edit posts to dl=1.

I guess they are all going to have different conventions.

3 个赞

我知道我在挖老帖的坟……但呃,Big Sur 这边全是最新系统,这些 Dropbox 链接在 Safari 里就是没法播放。*叹气*……

1 个赞

也许是因为文件被删除了?我在 Dropbox 里找到了一些新文件,我们可以测试一下:

5 个赞

@Falco 你回复中的那个音频文件,当我点击播放时,加载图标一直在旋转。

如果我复制地址……

它是

https://www.dropbox.com/s/yerjh0ddm6rjs21/Wakka%20Wakka.mp3?dl=1
1 个赞

在我的桌面和手机上都能正常运行,但我能理解多次重定向很容易导致问题。我建议 anyone 直接将文件上传到 Discourse。

2 个赞

哦!好观点……

HTTP/2 301 cache-control: no-cache,no-cache, no-store content-security-policy: sandbox content-type: text/html; charset=utf-8 date: Tue, 02 Mar 2021 16:17:05 GMT location: /s/dl/yerjh0ddm6rjs21/Wakka%20Wakka.mp3 pragma: no-cache referrer-policy: strict-origin-when-cross-origin server: envoy set-cookie: locale=en; Domain=dropbox.com; expires=Sun, 01 Mar 2026 16:17:05 GMT; Path=/; secure set-cookie: gvc=OTUwNzQ0Mzc3NzU2NjkxODM4OTE4NDk0MDgxMjAwNjgxMDIxMA%3D%3D; expires=Sun, 01 Mar 2026 16:17:05 GMT; httponly; Path=/; secure set-cookie: flash=; Domain=dropbox.com; expires=Tue, 02 Mar 2021 16:17:05 GMT; Path=/; secure set-cookie: puc=; expires=Tue, 02 Mar 2021 16:17:05 GMT; httponly; Path=/; secure set-cookie: bang=; Domain=dropbox.com; expires=Tue, 02 Mar 2021 16:17:05 GMT; Path=/; secure set-cookie: t=A0zo8e5fjm3PXvoUm3_M8Ore; Domain=dropbox.com; expires=Fri, 01 Mar 2024 16:17:05 GMT; httponly; Path=/; secure set-cookie: __Host-js_csrf=A0zo8e5fjm3PXvoUm3_M8Ore; expires=Fri, 01 Mar 2024 16:17:05 GMT; Path=/; secure x-content-type-options: nosniff x-frame-options: DENY x-permitted-cross-domain-policies: none x-robots-tag: noindex, nofollow, noimageindex x-xss-protection: 1; mode=block strict-transport-security: max-age=31536000; includeSubDomains strict-transport-security: max-age=31536000; includeSubDomains vary: Accept-Encoding x-dropbox-response-origin: far_remote x-dropbox-request-id: 014773fffd9744368958f7bd03e74ae3

这告诉我 Dropbox 更希望我们使用(针对你上面分享的文件,在回复中放入一个 dl=1 的 URL)……

https://www.dropbox.com/s/dl/yerjh0ddm6rjs21/Wakka%20Wakka.mp3

但这又只是再次重定向……

HTTP/2 302 cache-control: no-cache,no-cache, no-store content-security-policy: sandbox content-type: text/html; charset=utf-8 date: Tue, 02 Mar 2021 16:18:51 GMT location: https://uc210b381124f7e2c595f0144180.dl.dropboxusercontent.com/cd/0/get/BJ5026I61AGfxjUZw4UAy6BoWHpQbSEN0gROgXEQDAhej5g_ws5PGpMKoAWm2TFZ78wPD3W3jnOfiuXDCymHTnohQYszoTuUH5QxZXpRt3Ebjgzx5kywk-ucuWZRdlX1RC0/file?dl=1# pragma: no-cache referrer-policy: strict-origin-when-cross-origin server: envoy set-cookie: locale=en; Domain=dropbox.com; expires=Sun, 01 Mar 2026 16:18:51 GMT; Path=/; secure set-cookie: gvc=NjAxMjA0ODM0MjU5NzUxOTc0NzM5NTA4Mzk1NTUxODQ1NTYxMzI%3D; expires=Sun, 01 Mar 2026 16:18:51 GMT; httponly; Path=/; secure set-cookie: flash=; Domain=dropbox.com; expires=Tue, 02 Mar 2021 16:18:51 GMT; Path=/; secure set-cookie: puc=; expires=Tue, 02 Mar 2021 16:18:51 GMT; httponly; Path=/; secure set-cookie: bang=; Domain=dropbox.com; expires=Tue, 02 Mar 2021 16:18:51 GMT; Path=/; secure set-cookie: t=h92aZNHZPxQ0OvaeouTFBVK-; Domain=dropbox.com; expires=Fri, 01 Mar 2024 16:18:51 GMT; httponly; Path=/; secure set-cookie: __Host-js_csrf=h92aZNHZPxQ0OvaeouTFBVK-; expires=Fri, 01 Mar 2024 16:18:51 GMT; Path=/; secure x-content-type-options: nosniff x-frame-options: DENY x-permitted-cross-domain-policies: none x-xss-protection: 1; mode=block strict-transport-security: max-age=31536000; includeSubDomains strict-transport-security: max-age=31536000; includeSubDomains vary: Accept-Encoding x-dropbox-response-origin: far_remote x-dropbox-request-id: 29b87eb2e3ef458f9490ba6f202d95af

变为

https://uc210b381124f7e2c595f0144180.dl.dropboxusercontent.com/cd/0/get/BJ5026I61AGfxjUZw4UAy6BoWHpQbSEN0gROgXEQDAhej5g_ws5PGpMKoAWm2TFZ78wPD3W3jnOfiuXDCymHTnohQYszoTuUH5QxZXpRt3Ebjgzx5kywk-ucuWZRdlX1RC0/file?dl=1#

让我看看,如果我把这个链接放在这里会发生什么……

https://uc210b381124f7e2c595f0144180.dl.dropboxusercontent.com/cd/0/get/BJ5026I61AGfxjUZw4UAy6BoWHpQbSEN0gROgXEQDAhej5g_ws5PGpMKoAWm2TFZ78wPD3W3jnOfiuXDCymHTnohQYszoTuUH5QxZXpRt3Ebjgzx5kywk-ucuWZRdlX1RC0/file?dl=1#

¯\\_(ツ)_/¯ 这又是我列出的不使用 Dropbox 的理由之一

2 个赞

公平地说,Dropbox 从未声称自己是像 Imgur 那样的热链接存储服务。

如果您打算在 Discourse 中大量使用此类媒体文件,您有许多替代方案:

  • 直接上传到 Discourse(可选择由对象存储服务支持,并由 CDN 提供保护)

  • 数十种支持嵌入的专用媒体托管服务,如 YouTube、Vimeo、SoundCloud、Peertube 等。

3 个赞

嗨 @craigconstantine(很高兴见到你),你是否记得 Dropbox 分享链接中原始链接末尾是 dl=0 的情况?如果你将其编辑为 raw=1,它应该能作为一个播放器正常工作,适用于大多数使用不同操作系统和浏览器的用户。详细信息在 Dropbox 官网上,不过我可能略微忽略了关于多次重定向的要点。希望这能帮到你。

https://www.dropbox.com/s/yerjh0ddm6rjs21/Wakka%20Wakka.mp3?raw=1

2 个赞

……不,这正是问题的关键。它在 Safari 上已经无法工作了。你提供的 Dropbox 链接到 MP3 文件,虽然生成了一个看似音频播放器的界面,但实际上无法播放。

1 个赞

我的错——没往前看够远。

在 Mac 上的 Chrome 浏览器中,有时无法播放,但强制刷新(Chrome 中为 Cmd-Shift-R)会重新加载页面并使文件可播放。在 Safari 中则是 Shift 刷新,但这并不能使其可播放。

现在明白了——在 Safari 中,我看到旋转图标,然后出现这个:

我仍在使用 Catalina 系统,它无法工作——不知道问题出在哪里?

也许我们不得不避免使用美观的播放器,这会很可惜。如果你将链接作为内联 HTML 超文本包含,Dropbox 共享链接末尾的 dl=0 会打开一个新浏览器窗口,显示 Dropbox 预览和播放页面;dl=1 会强制下载;raw=1 则会在一个新浏览器窗口中显示像 Discourse 中那样的美观播放器并开始播放。不确定这是否有帮助,但或许能为你提供一个有用的选项。

你好 @Falco,这是否需要调整管理员中的上传文件大小限制?还是需要使用你之前提到的对象存储服务/CDN?

如果你计划上传超过默认限制的文件,可以按照以下步骤增加限制:Change the maximum attachment/upload size

如果你有能力支付对象存储服务的费用,并且你的社区将上传大文件,那这绝对是一个正确的选择 :+1:

1 个赞

大家好。刚看到这个帖子。据我理解,情况总结如下:

  1. 目前,如果你在 Discourse 中包含一个 Dropbox 音频链接,系统会尝试对其进行“一键预览”(onebox)——即尝试将该链接转换为可在 Discourse 帖子内直接播放的音频播放器。

  2. 但是,Dropbox 不允许远程播放。因此,用户只会看到一个无法实际播放的音频播放器。你可以尝试在链接末尾添加 ?dl=1 以启用播放器播放,但这在大多数浏览器中实际上也无效(例如,在我使用的 Chrome 浏览器中就不行)。

  3. 替代方案是让用户直接上传文件——但这可能会很昂贵,因为音频文件可能很大,或者使用 Dropbox 以外的其他服务。

我认为第一个帖子中的原始问题仍然有效——如果“一键预览”无法正常工作,那么最好关闭该链接的一键预览功能,以便用户获得最直接的结果:一个能让他们访问 Dropbox 上实际文件的链接。

用户可能不会理解我刚才列出的第 1 到第 3 步。他们只会认为 Dropbox 链接要么(1)自动播放,要么(2)带你进入 Dropbox 网站并在那里播放。因此,如果文件无法播放,最好直接提供一个链接,让用户点击后前往 Dropbox 查看文件。

您是否尝试在站点设置的“阻止的一键域名”中输入 dropbox.com(或正确的域名)?

好主意——我测试了一下,结果令人惊讶:

  1. 在“屏蔽的一键预览域名”设置中,我输入了:www.dropbox.com、https://dropbox.com、dropbox、https://www.dropbox.com(我不确定哪种格式是正确的,所以想全面覆盖)。

  2. 操作之后,音频文件既没有一键预览,也没有转换成(无法使用的)音频播放器,而是直接显示为 Dropbox 链接。既然 Dropbox 在非 Dropbox 网站上无法播放音频,这似乎是音频内容的最佳结果。

  3. 但是:其他 Dropbox 内容的一键预览似乎仍然会发生(令人惊讶),即使已在“屏蔽的一键预览域名”设置中加入了 dropbox。例如,粘贴一个 Dropbox 图片链接后,Discourse 帖子中仍然直接显示了该图片本身。

1 个赞

猜测一下,可能是因为音频 URL 位于 www.dropbox.com,被您输入的第一个规则所拦截,而图片位于 dropbox.com 或 somethingelse.dropbox.com,未被您输入的其他规则所拦截。

从描述中尚不完全清楚,但该设置适用于输入的域名及其所有子域名。因此,输入确切的值 dropbox.com 将拦截 dropbox.com、www.dropbox.com 以及 anythingelse.dropbox.com。

1 个赞