Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
A YouTube URL like https://www.youtube.com/embed/videoID
is a valid URL and valid YouTube video ID can be extracted from this URL. But right now this is not possible due to YouTube::getIdFromInput()
regex limitations.
Proposed resolution
Improve the video ID detection in YouTube::getIdFromInput()
to allow video embed URLs like https://www.youtube.com/embed/videoID
.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#18 | also_allow_embed_urls-2899093-D8-17.patch | 12.47 KB | idimopoulos |
| |||
#18 | interdiff.txt | 11.04 KB | idimopoulos |
#12 | interdiff.txt | 1.58 KB | slashrsm |
#12 | 2899093_12.patch | 4.46 KB | slashrsm |
| |||
#11 | interdiff.txt | 1.45 KB | slashrsm |
Comments
Comment #2
claudiu.cristeaPatch.
Comment #3
claudiu.cristeaComment #5
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedThere is already a provider written to handle youtube playlists. I think this already works as expected.
Comment #6
claudiu.cristeaIt's not about playlists, I'll remove that from the ticket. It's about improving the regex for YouTube to allow URLs like
https://www.youtube.com/embed/<videoID>
, which are valid URLs.Comment #7
claudiu.cristeaEDIT: comment deleted
Comment #8
claudiu.cristeaOK, Now this resolves also the
https://www.youtube.com/embed/<videoID>
case, but nothttps://m.youtube.com/embed/<videoID>
(which is not allowed).Other improvements:
http://m.youtube.com/...
youtube.com/...
orwww.youtube.com/...
Comment #9
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedWhat about creating two regexes? This is getting really big.
Comment #10
claudiu.cristeaIn fact this is true also for Vimeo. https://player.vimeo.com/video/225133231 is a iframe embed URL but should be a valid video URL.
Comment #11
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedI can confirm that the patch works as expected. I added support for Vimeo as proposed in #10.
Comment #12
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedWhile working on migration also ran into cases with implicit protocol on Youtube. Also covered that.
Comment #13
MaskOta CreditAttribution: MaskOta commentedThis is probably not the scope of this issue but... shouldn't we also try to parse any additional options that the user might want to input?
for example if you have:
https://www.youtube.com/embed/TLzf4ovpVWY?autoplay=1&controls=0&loop=1&p...
the video would then autoplay, loop etc.
Comment #14
claudiu.cristeaIf it's not in the scope of the issue please don't switch the status.
Comment #15
MaskOta CreditAttribution: MaskOta commentedSorry
I have created a new issue #2935962: Parse additional parameters from URL and use them in the embeding
Comment #16
gaurav.bajpai CreditAttribution: gaurav.bajpai as a volunteer and commentedComment 12 is working for me for mobile youtube URL (m.youtube.com)
Comment #17
AnybodyPlease also extend the regex to allow "https://www.youtube-nocookie.com/embed" which is used for privacy (GDPR, ...).
We should allow users to also paste that code. The parameters are the same as for youtube. I don't think it would make sense to have a separate issue for that patch because it's very close to this one.
Comment #18
idimopoulos CreditAttribution: idimopoulos at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedI did some minor changes to this patch.
youtube-nocookie
domain for embedded URLs as this issue is already for embedded URLs.#
https:////
was acceptable.Comment #19
idimopoulos CreditAttribution: idimopoulos at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedThe latest patch from #18 also applies to 8.x-2.x. Should we clone the issue for that too?
Also, I postponed https://www.drupal.org/project/video_embed_field/issues/3060201 in favor of the current ticket.
Comment #20
zaporylieSince 2.x is the current default and this patch applies there I'm changing the targeting version. Version will be changed back once patch gets in to 8.x-2.x first.
I reviewed the patch + applied on the project with variety of youtube urls (many different formats) and, thanks to #18, all these formats are now supported. I don't see any remaining blocking issues hence I'm changing status to RTBC.
Comment #21
Chris Matthews CreditAttribution: Chris Matthews commentedComment #22
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedWith the advent of Media in core, the Video Embed Field module has moved to being minimally maintained. Only issues which assist in the migration to Media in core will be committed. To read more about this decision, please see: #3089599: Maintenance status for Video Embed Field now that media is in core.
Comment #23
mkindred CreditAttribution: mkindred commentedPatch #18 worked for me in D9.2.9.
Comment #24
GagikSargsyanWeb CreditAttribution: GagikSargsyanWeb commentedPatch #18 worked for me too in D9.3.15, PHP 7.4.27