本文整理汇总了PHP中Zend_Gdata_YouTube::getUserFavorites方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_YouTube::getUserFavorites方法的具体用法?PHP Zend_Gdata_YouTube::getUserFavorites怎么用?PHP Zend_Gdata_YouTube::getUserFavorites使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_YouTube
的用法示例。
在下文中一共展示了Zend_Gdata_YouTube::getUserFavorites方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFavoritesByUser
/**
* get videos favorited by username
* @param string $username
* @return Zend_Gdata_YouTube_VideoFeed
*/
public function getFavoritesByUser($user, $page = 0)
{
/* @var $ytq Zend_Gdata_YouTube_VideoQuery */
$ytq = $this->yt->newVideoQuery(Zend_Gdata_YouTube::USER_URI . '/' . $user . '/' . Zend_Gdata_YouTube::FAVORITES_URI_SUFFIX);
$page = $page * self::ITEMS_PER_PAGE;
$ytq->setStartIndex($page == 0 ? $page : $page + 1);
$ytq->setMaxResults(self::ITEMS_PER_PAGE);
$ytq->setOrderBy('published');
return $this->yt->getUserFavorites(null, $ytq);
}
示例2: array
$matches = array();
$result = mysql_query("SELECT * FROM matchids WHERE " . $crawl_string . " or sessionid = 680462533 LIMIT 0, 10");
while ($row = mysql_fetch_array($result)) {
if ($row['sessionid'] > 1000000) {
$matches["match_" . strtolower(dechex($row['sessionid']))] = $row;
}
}
echo 'Crawling ' . count($matches) . ' match(es)<br/>';
$matchlist = implode(' | ', array_keys($matches));
if (empty($matchlist)) {
die;
}
echo $matchlist . "<br/>";
$query = $yt->newVideoQuery();
$query->setVideoQuery($matchlist);
$query->setMaxResults(50);
$videoFeed = $yt->getVideoFeed($query->getQueryUrl(2));
foreach ($videoFeed as $videoEntry) {
preg_match_all("/(Scout|Soldier|Pyro|Demoman|Heavy|Engineer|Medic|Sniper|Spy)|match_([0-9a-f]{6,})/", implode("|", $videoEntry->getVideoTags()), $matchid);
$authobj = $videoEntry->getAuthor();
$matchinfo = $matches[$matchid[0][1]];
if (mysql_num_rows(mysql_query("SELECT youtubeid FROM videos WHERE youtubeid = '" . $videoEntry->getVideoId() . "'")) != 0) {
mysql_query("UPDATE videos SET title = '" . mysql_real_escape_string($videoEntry->getVideoTitle()) . "', description = '" . mysql_real_escape_string($videoEntry->getVideoDescription()) . "' WHERE youtubeid = '" . $videoEntry->getVideoId() . "'");
echo mysql_error();
} else {
$nextmatch = mysql_fetch_array(mysql_query("SELECT * FROM matchids WHERE matchdate > '" . $matchinfo['matchdate'] . "' AND serverid = " . $matchinfo['serverid'] . " LIMIT 1"));
mysql_query("INSERT INTO videos ( youtubeid, youtubeuser, map, sessionid, matchdate, matchduration, role, serverid, duration, title, description ) VALUES ( '" . $videoEntry->getVideoId() . "', '" . $authobj[0]->getName() . "', '" . $matchinfo['mapname'] . "', '" . $matchinfo['sessionid'] . "', '" . $matchinfo['matchdate'] . "', '" . (strtotime($nextmatch['matchdate']) - strtotime($matchinfo['matchdate'])) . "', '" . $matchid[0][0] . "', '" . $matchinfo['serverid'] . "', '" . $videoEntry->getVideoDuration() . "', '" . mysql_real_escape_string($videoEntry->getVideoTitle()) . "', '" . mysql_real_escape_string($videoEntry->getVideoDescription()) . "' )");
echo mysql_error();
$yt->insertEntry($videoEntry, $yt->getUserFavorites("LethalZone")->getSelfLink()->href);
}
}