On a website, i use API Youtube with ZendGdata for retrieve all video of a user and create webpage with the video and his informations.
Now i need to add a system for like or dislikes video on my website, and i need to retrieve the number of likes and dislikes.
(Yes, there are 2 questions here^^)
So, i retrieve for example title with $videoEntry->getVideoTitle();, number of views with $videoEntry->getVideoViewCount(); but how i can retrieve number of likes/dislikes ?
And how i can vote for a video on my website ?
If you take a look at the videos resource in YouTube 3.0 API, among the values included are:
likeCount
dislikeCount
Full details here: https://developers.google.com/youtube/v3/docs/videos
If you're using the YouTube 2.0 API, then check out the <yt:rating> tag, which contains the following fields:
numLikes
numDislikes
More info here: https://developers.google.com/youtube/2.0/reference#youtube_data_api_tag_yt:rating
An update to Cormac answer is that youtube will remove this and you can use it for yourself only.
Note: The statistics.dislikeCount property will be made private as of December 13, 2021. This means that the property will only be included in an API response if the API request was authenticated by the video owner. See the revision history for more information.
Related
Iam building a social network website.
I want to crawl information of ALL images by a hashtag on Instagram by using Instagram API. ( I only store url link to instagram image, without store image on my server )
Is is possible ? Or Instagram API only response a limit number of recent images ?
Thanks all!
When looking at the API docs, it seems that the total amount of media on a certain hashtag can be looked up, but the actual media can only be found for recent posts.
So if you actually want to save all media, you might want to scrape all data every now and then. You do have a limit on how many times you can scrape though.
Using API you can get all hashtag media, it will start with most recent posts, you have to paginate and can get call data.
https://api.instagram.com/v1/tags/{tag-name}/media/recent?access_token=ACCESS-TOKEN
As of Oct 1, 2017, Instagram no longer gives permission for public_content scope that is required to access this data, if dont already have your app approved, you will not be able to use this API :(
I'm using the Facebook Graph API in PHP to pull tagged and uploaded photos from a user. We are currently using the /me/photos... endpoint to grab both kinds of photos. On our side, the code roughly looks like...
$api_call = $this->facebook->api("me/photos?date_format=U&since=$since_time&until=$current_time&limit=".$photo_limit);
// Valid response was received
if(isset($api_call['data'])){
// Get the photos the user is tagged in
$user_tagged_photos = $api_call['data'];
}
Variables in the URL string are just vars we set. We then just do the same thing for uploaded photos.
However, what my team has realized is that users also sometimes are tagged in posts that have associated pictures with them. So, maybe they are tagged in a post with a picture of them, but they aren't physically tagged in the photo.
Is there a method available for grabbing photos from posts a user is tagged in? The graph api reference for /post/ lists "picture" as a field but describes it as:
The picture scraped from any link included with the post.
Which is not what I want. I want the attached picture, just can't seem to find a way to access...
Thanks in advance for any help.
In that case, object_id in the Post object that gets returned when making a request to /{user-id}/tagged should be the ID of any photo/video that is attached to the post the user is tagged in.
Check the docs for the /post endpoint.
I want to get related videos on Youtube when user enters the video id on my system. But system will work like this:
User will enter video id
System will find related videos of the video that user entered.
After that, system will choose one of the related videos and start to get that video's related vids list.
System will repeat this for 10 times.
And will show to user last video.
So, my problem is getting first video's related video and after last video's, after last video's etc... And my aim is try to find the journey from first video to last video.
How can I do this?
You can do this via search->list method specifying relatedToVideoId.
You can use PHP API client.
Here is a similar sample. https://github.com/youtube/api-samples/blob/master/php/search.php
how can i use php to get youtube user subscription channel videos and display all the channel feeds, i want create a class or function where if i pass a user name the php class would retrieve the latest uploads / activities in the user subscribed channels and display the url plus the title and the image, also i want to be able to pass the title and url to other functions so that i can save it to database. on a another page i found this Pulling in YouTube Videos from Specific Channel but its for only one specific channel.
The relevant requests are for the newsubscriptionvideos feed in the YouTube GData API v2 or activities.list() in the newer YouTube Data API v3.
newsubscriptionvideos might not be natively support in the Zend GData client library (I don't see it mentioned in the developer's guide), so if you go that route, you should probably use alt=jsonc to get back an easy-to-parse JSON feed of the data. E.g, https://gdata.youtube.com/feeds/api/users/jeffposnicktest/newsubscriptionvideos?v=2&alt=jsonc
The alternative is to use v3's PHP client library to call activities.list().
I need to access Youtube channel's demographics data with oauth.
One problem is that Youtube api called insight only provides zipped folders with csv files.
While I can probably download the zip, unzip, access the file, and delete the original once I get the data I need, I was wondering if there is any other way to get youtube channel's demographics data.
I believe that yes, using the new YouTube Analytics API:
https://developers.google.com/youtube/analytics/v1/available_reports
From the doc:
Channel reports
The table below lists the different types of channel reports accessible via the API. To retrieve a channel report, set the ids parameter value to channel==USER_ID, where USER_ID specifies the YouTube user ID of the currently authenticated user.
And I think that is the report you wants:
dimensions: country
metrics: views, comments, favoritesAdded, favoritesRemoved, likes, dislikes, shares, subscribersGained, subscribersLost
filters: video
or this one:
dimensions: ageGroup, gender
metrics: viewerPercentage
filters: country video(,country)
and this example shows how to call the API:
https://developers.google.com/youtube/analytics/v1/sample-application