Skip to content

Commit

Permalink
5: fix regex for youtube url
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah committed Jul 1, 2024
1 parent 757bc6e commit cbee236
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/models/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private function parse($url): void
preg_match("/[&?]list=([^&]+)/i", $url, $match);
$this->id = $match[1];
} else {
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)|shorts/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match);
preg_match('/^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube(?:-nocookie)?\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|live\/|v\/)?)([\w\-]+)(\S+)?$/', $url, $match);
$this->id = $match[1];
}

Expand Down

0 comments on commit cbee236

Please sign in to comment.