Skip to content

Instantly share code, notes, and snippets.

View Kaligula0's full-sized avatar

Kaligula Kaligula0

View GitHub Profile
@Kaligula0
Kaligula0 / YouTube_URLs.regexp
Last active April 24, 2024 07:30
A RegExp that matches all valid YouTube video URLs.
^(?:(?:https?:)?\/\/)?(?:(?:(?:www|m(?:usic)?)\.)?youtu(?:\.be|be\.com)\/(?:shorts\/|live\/|v\/|e(?:mbed)?\/|watch(?:\/|\?(?:\S+=\S+&)*v=)|oembed\?url=https?%3A\/\/(?:www|m(?:usic)?)\.youtube\.com\/watch\?(?:\S+=\S+&)*v%3D|attribution_link\?(?:\S+=\S+&)*u=(?:\/|%2F)watch(?:\?|%3F)v(?:=|%3D))?|www\.youtube-nocookie\.com\/embed\/)([\w-]{11})[\?&#]?\S*$