我在尝试从用户的个人资料中提取总上传视图时遇到问题。这是我目前拥有的脚本。一切正常,直到我尝试拉getTotalUploadViews()
。
任何人都知道我该如何解决这个问题?
global $yt;
// set protocol version to 2 to retrieve a v2 profile entry,
// which contains additional information from the user's profile
$yt->setMajorProtocolVersion(2);
// enter a username or set the $userName variable to 'default'
// to retrieve the currently authenticated user's profile
$userProfileEntry = $yt->getUserProfile($userName);
echo "<h3>Profile Information</h3><br />";
$userInfo = $userProfileEntry->getUsername();
echo '<span><a href="http://youtube.com/user/'.$userInfo.'"><h4><img src="img/youtube.jpg" style="height:20px;width:20px;" /> '.$userInfo.'</h4></a></span><br />';
$proImage = $userProfileEntry->getThumbnail()->getUrl();
echo '<img src="'.$proImage.'" style="height:150px;" class="img-polaroid"/><br />';
echo '<hr>';
// retrieve counts of favorites, contacts, subscriptions and uploads
// by examining the feedLink elements in the profile
$statistics = $userProfileEntry->getStatistics();
echo '<br /><br />';
echo
'
<div class="tabbable tabs-left" id="info-tabs">
<ul class="nav nav-tabs">
<li class="active">
<a href="#bi" data-toggle="tab">Member Info</a>
</li>
<li>
<a href="#vi" data-toggle="tab">Channel Statistics</a>
</li>
<li>
<a href="#oi" data-toggle="tab">Other Info</a>
</li>
</ul>
<div class="tab-content" id="tabed-info">
<div class="tab-pane fade in active" id="bi">
<p>
<strong>Member Since: '.$userProfileEntry->getPublished()->text.'</strong><br />
<strong>Last Update: '.$userProfileEntry->getUpdated()->text.'</strong>
</p>
</div>
<div class="tab-pane fade" id="vi">
<p>
<strong>Favorite Videos: '.$userProfileEntry->getFeedLink('http://gdata.youtube.com/schemas/2007#user.favorites')->countHint.'</strong><br />
<strong>User Contacts: '.$userProfileEntry->getFeedLink('http://gdata.youtube.com/schemas/2007#user.contacts')->countHint .'</strong><br />
<strong>Subscriptions: '.$userProfileEntry->getFeedLink('http://gdata.youtube.com/schemas/2007#user.subscriptions')->countHint.'</strong><br />
<strong>Video Uploads: '.$userProfileEntry->getFeedLink('http://gdata.youtube.com/schemas/2007#user.uploads')->countHint.'</strong><br />
</p>
</div>
<div class="tab-pane fade" id="oi">
<p>
<strong>Channel Views: '.$statistics->getViewCount().'</strong><br />
<strong>Videos Watched: '.$statistics->getVideoWatchCount().'</strong><br />
<strong>Subscribers Count: '.$statistics->getSubscriberCount().'</strong><br />
<strong>Test: '.$statistics->getTotalUploadViews().'</strong>
</p>
</div>
</div>
</div>
';
在我尝试回<strong>'.$statistics->getTotalUploadViews().'</strong>
显页面后,只加载了一半。