0

このコードが機能するYouTubeビデオを取得します。

<?php   
$feedURL = "http://gdata.youtube.com/feeds/api/users/".$user."/uploads?max-results=20";
    $sxml = simplexml_load_file($feedURL);
    $i=0;
    foreach ($sxml->entry as $entry) {
      $media = $entry->children('media', true);
      $watch = (string)$media->group->player->attributes()->url;   
      $url = clear($watch); 
//..............................
?>

しかし、ユーザーはYouTubeを禁止され、空白のページが表示されます

User account suspended

http://gdata.youtube.com/feeds/api/users/MonsterJamVEVO/uploads?max-results=5

テキストの取得方法(ユーザーアカウント停止中) タグがないため。ありがとう。

4

1 に答える 1

0

応答ヘッダーは問題を示しています。

HTTP/1.1 403 禁止

したがって、これらのエラーを確認する必要があります。

$feedURL = "http://gdata.youtube.com/feeds/api/users/".$user."/uploads?max-results=20";

if (($contents = @file_get_contents($feedURL)) === false) {
    echo "$feedURL could not be loaded\n";
} else {
    $sxml = simplexml_load_string($contents);
    // rest of your code
}
于 2013-09-06T06:39:29.093 に答える