Created
April 11, 2016 21:46
-
-
Save webarthur/24baeaa33f6a7f412d07f94a49b05887 to your computer and use it in GitHub Desktop.
Get youtube Channel ID by channel url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_youtube_channel_ID($url){ | |
$html = file_get_contents($url); | |
preg_match("'<meta itemprop=\"channelId\" content=\"(.*?)\"'si", $html, $match); | |
if($match && $match[1]); | |
return $match[1]; | |
} |
Still works :)
Thanks.
Works well. Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not working in new design.