Skip to content

Instantly share code, notes, and snippets.

@webarthur
Created April 11, 2016 21:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save webarthur/24baeaa33f6a7f412d07f94a49b05887 to your computer and use it in GitHub Desktop.
Save webarthur/24baeaa33f6a7f412d07f94a49b05887 to your computer and use it in GitHub Desktop.
Get youtube Channel ID by channel url
<?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];
}
@Bizunow
Copy link

Bizunow commented Sep 1, 2017

This is not working in new design.

@mrabro
Copy link

mrabro commented Jun 17, 2022

Still works :)
Thanks.

@danielalvescruz
Copy link

Works well. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment