Embedded Youtube Videos: URL always showing "https://youtube.com/devicesupport"

AI-generated summary

Users reported a bug where embedded YouTube videos displayed the URL ‘https://youtube.com/devicesupport’ in the image preview before the video loaded, though the actual video playback remained functional Yuun. lidel identified the root cause as the deprecation of the YouTube API v2, which was previously used by the lazyYT library to fetch video titles. techAPJ explained that migrating to the required API v3 would necessitate Google Account credentials and quota management, which was not ideal. Instead, techAPJ implemented a fix by switching to the YouTube oEmbed endpoint, which avoids these dependencies. The solution was deployed via Discourse and onebox pull requests. A side effect of this change is that video titles are now saved as HTML during the oneboxing process rather than being fetched at runtime, meaning previously embedded videos may initially show a link instead of a title until re-rendered. codinghorror and techAPJ subsequently tested the fix with new video links to confirm the resolution.

As seen here:

There don’t seem to be any unusual steps needed to produce this bug, just posting a youtube video will do it. Affects videos posted before today as well (assuming a recent update is the cause).

Everything else related to the video (actual link to original, video replay) is unaffected.

Update - this appears to only applies to the image generated before the actual video loads. Clicking ‘play’ and loading the video switches out the /devicesupport URL for the title of the Youtube video.

「いいね!」 8

Weird @techapj can you have a look?

I just noticed this, too.

「いいね!」 1

The devicesupport message is probably displayed due to deprecation of old API v2 (used by lazyYT while fetching title):

In March 2014, we announced that the v2 API would be retired in April 20, 2015, and would be shut down soon thereafter. To help you with your migration, we launched the migration guide in September. Now, we’d like to provide you with more details on the plan to retire v2.

– http://youtube-eng.blogspot.com/2015/03/dude-are-you-still-on-youtube-api-v2.html

The fix is being prepared upstream:

https://github.com/tylerpearson/lazyYT/issues/34

「いいね!」 7

Any news on this @techapj

YouTube Data API (v3) now requires Google Account and registering a new application to retrieve video info via v3 API :disappointed:

Also:

The YouTube Data API uses a quota to ensure that developers use the service as intended and do not create applications that unfairly reduce service quality or limit access for others. All API requests, including invalid requests, incur at least a one-point quota cost.

More info here: YouTube Data API Overview  |  Google for Developers

Looking into it.

EDIT: I may have a fix, working on it.

「いいね!」 3

Fixed via:

https://github.com/discourse/discourse/pull/3437

and

https://github.com/discourse/onebox/pull/298


The solution I came up with is to use YouTube oEmbed endpoint instead of v3 API.

This is the only way to fix this issue without depending on v3 API (that requires Google Account credentials).

Also, note that previously oneboxed YouTube videos will have video link instead of title, like

It’s because until now video title was fetched via API (at runtime), but now video title will be saved as HTML at the time of oneboxing.

「いいね!」 2

Let’s see

「いいね!」 1

Let’s hope it works this time :pray:

「いいね!」 8