Jack Phoenix has submitted this change and it was merged. Change subject: Support the older <youtube>video ID</youtube> syntax. ......................................................................
Support the older <youtube>video ID</youtube> syntax. This is a follow-up to https://gerrit.wikimedia.org/r/#/c/101672/ Reported on the ShoutWiki Bugzilla: http://bugzilla.shoutwiki.com/show_bug.cgi?id=249#c2 Change-Id: I8e2ae0d200e286de1478bf294cd02bc569b056a8 --- M YouTube.php 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Jack Phoenix: Verified; Looks good to me, approved diff --git a/YouTube.php b/YouTube.php index 76cdc89..dc75957 100644 --- a/YouTube.php +++ b/YouTube.php @@ -71,8 +71,11 @@ // @see http://linuxpanda.wordpress.com/2013/07/24/ultimate-best-regex-pattern-to-get-grab-parse-youtube-video-id-from-any-youtube-link-url/ $pattern = '~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@?&%=+\/\$_.-]*~i'; $id = false; + if ( preg_match( $pattern, $url, $preg ) ) { $id = $preg[1]; + } elseif ( preg_match( '/([0-9A-Za-z_-]+)/', $url, $preg ) ) { + $id = $preg[1]; } return $id; -- To view, visit https://gerrit.wikimedia.org/r/105382 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8e2ae0d200e286de1478bf294cd02bc569b056a8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/YouTube Gerrit-Branch: master Gerrit-Owner: Jack Phoenix <j...@countervandalism.net> Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits