Php 如何登录YouTube并获取此页面的内容?
请帮助我获取页面内容,如:Php 如何登录YouTube并获取此页面的内容?,php,youtube-api,Php,Youtube Api,请帮助我获取页面内容,如: http://www.youtube.com/my_videos_annotate?feature=vm&v=someVideoId 使用PHP/Curl 我想我需要先登录YouTube的服务,但不知道怎么做。使用YouTube api 示例 $feedURL = 'http://gdata.youtube.com/feeds/api/users/**ACCOUNTNAME**/uploads?max-results=50'; $sxml = simplex
http://www.youtube.com/my_videos_annotate?feature=vm&v=someVideoId
使用PHP/Curl
我想我需要先登录YouTube的服务,但不知道怎么做。使用YouTube api示例
$feedURL = 'http://gdata.youtube.com/feeds/api/users/**ACCOUNTNAME**/uploads?max-results=50';
$sxml = simplexml_load_file($feedURL);
$i=0;
foreach ($sxml->entry as $entry) {
$media = $entry->children('media', true);
$watch = (string)$media->group->player->attributes()->url;
$thumbnail = (string)$media->group->thumbnail[0]->attributes()->url;
$input = array('http://www.youtube.com/watch?v=','&feature=youtube_gdata_player');
$change = array('','') ;
$link = @str_replace ($input ,$change, $watch);
echo $link.'</br>';
echo $thumbnail.'</br>'; //**thumbnail
echo $media->group->title.'</br>'; //**title
echo $media->group->description.'</br>'; //**description
}
$feedURL='1!'http://gdata.youtube.com/feeds/api/users/**ACCOUNTNAME**/上传?最大结果=50';
$sxml=simplexml\u加载文件($feedURL);
$i=0;
foreach($sxml->entry as$entry){
$media=$entry->children('media',true);
$watch=(字符串)$media->group->player->attributes()->url;
$thumbnail=(字符串)$media->group->thumbnail[0]->attributes()->url;
$input=数组('http://www.youtube.com/watch?v=“,”&feature=youtube_gdata_player”);
$change=数组(“”,”);
$link=@str_replace($input,$change,$watch);
echo$link.“”;
回显$thumbnail.“”;//**缩略图
echo$media->group->title.“”;//**title
echo$media->group->description.'';//**description
}
希望这会有所帮助您想获取页面内容还是仅获取视频?如果没有,请让我知道。我尝试了登录用户的页面内容(我有电子邮件/密码)和一些等效的CURL+cookies解决方案,我收到“我需要打开cookies”抱歉,但这适用于xml数据,是html页面。只有当用户是someVideoId的作者时,才能打开此页面。并且没有API来获取编辑注释页面的内容。