youtube赞/订阅会显示在用户帐户中,但不会显示在视频/频道
中我正在制作一个人们接受youtube权限的网页(使用manage youtube帐户范围),他们可以喜欢视频或通过网络订阅频道。
喜欢:
$sql = "UPDATE track SET `In/Out`= $Clock WHERE EmployeeName= '$employeename'";
订阅问题是:
- the user see that has liked the video
- noone never sees the total likes going up
以下是用户在一天或更长时间后看到它的方式的图像:link to image
我喜欢使用的代码是:
- at the beginning the user can see he is subscribed to the channel
- after few hours everyone can see the increased number of subscribers
- some time later (like one day or more), the subscribers decreased
- but the user can still see that is subscribed
对于订阅基本相同,唯一的区别在于if:
<?php
require_once 'Google/Client.php';
require_once 'Google/autoload.php';
require_once 'Google/Service/YouTube.php';
session_start();
$client_id= $_POST['client'];
$client_secret= $_POST['secret'];
$refreshtoken = $_POST['ref'];
$idvideo = $_POST['idvideo'];
$client = new Google_Client();
$client->setClientId($client_id);
$client->setClientSecret($client_secret);
$client->setScopes('https://www.googleapis.com/auth/youtube');
$client->refreshToken($refreshtoken );
$redirect = filter_var('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'], FILTER_SANITIZE_URL);
$client->setRedirectUri($redirect);
$youtube = new Google_Service_YouTube($client);
if (isset($_GET['code'])) {
if (strval($_SESSION['state']) !== strval($_GET['state'])) {
die('The session state did not match.');
}
$_SESSION['token'] = $client->getAccessToken();
header('Location: ' . $redirect);
}
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
if ($client->getAccessToken()) {
try {
$youtube->videos->rate($idvideo, "like");
// It always arrives here
} catch (Exception $e) {
//
}
$_SESSION['token'] = $client->getAccessToken();
} else {
// If the user has not authorized the application, start the OAuth 2.0 flow.
$state = mt_rand();
$client->setState($state);
$_SESSION['state'] = $state;
$authUrl = $client->createAuthUrl();
}
?>
我不知道谷歌是否将我的网页视为奇怪的东西或问题是什么,但我已经在同一时间出现了一周,并且没有发现任何类似的问题。
此外,该网页未在www.blacklistalert.org或mxtoolbox.com上列入黑名单