rushkoff / rushkoff-archive

Douglas Rushkoff's article archive
0 stars 1 forks source link

Ensure all YouTube link types are embeddable #7

Closed wu-lee closed 1 year ago

wu-lee commented 1 year ago

The Gem currently used to embed YT links has a bug, which inserts a crazy looking URL if it fails to match the expected URLs.

Fix this, and try to ensure ensure all kinds of YT URL work.

May need replacing/fixing the gem.

Futureproofing: this feature is a convenience for users who just want to cut and paste. YT URLs as they appear in their website are not embeddable - they need to be converted into an embeddable URL, and wrapped in an <iframe> tag with the right attributes. Basically this is done by stripping out the video ID and pasting it back into the right place in a suitable <iframe> tag.

But this could be broken by YT adding new URL types, or changing their video IDs, or various other things. We can't really defend against that if the videos are on YT.

An alternative might be to link, not embed. But this could still be broken by YT.

What is most future proof is storing the videos somewhere under our control. Possibly GitHub, but maybe somwhere else with more capacity (as well as longevity). But that is out of the scope of this issue.

wu-lee commented 1 year ago

Ok, I've patched the Gem (actually, a newer fork I discovered called youtube_rails) to match what seems a fairly diverse set of current YouTube URLs and the tests all pass again.

I've submitted this back to the author, but in the mean time am using my fork of the Gem.