I use the Graph API to publish live videos of a user in my app. I can retrieve details of that video with the videoId when the video is not live anymore, and I get a status of LIVE_STOPPED (and later I get a status of VOD).
So my question, is there any way to know the duration (length) of the video when it's over?
I tried to get the field length, but it's not available, and seconds_left returns 0.
I tried to get the field length, but it's not available
Not on the live video itself, no. But the live video has a field video, the documentation describes it as “The inside video of the live video” - and that is a normal Video object, and as such has a length property.
(Not sure at which point that will contain a sensible value in this constellation though, you’d have to check.)
Related
I make a GET request for a video post on facebook to see how many times the video has been viewed (e.g., "https://graph.facebook.com/v3.2/{userid_postid}/insights/post_video_views?period=lifetime&access_token={access_token}") and this returns a value of 15k. However, if I visit the webpage itself (e.g., https://www.facebook.com/{userid_postid}), I see "60k Views" just below the video frame.
I apologize for my ignorance, but how can I access the 60k value through the API?
[1] https://developers.facebook.com/docs/graph-api/reference/v3.2/insights
Found the answer to returning the 60k number in the example above: "https://graph.facebook.com/v3.2/{video_id}/video_insights/total_video_views?period=lifetime&access_token={access_token}"
[1] https://developers.facebook.com/docs/graph-api/reference/video/video_insights/
What is the "monetization_status" of video in Facebook api and when to use it?
I am looking for any documentation about this field and the only page I found is this: https://developers.facebook.com/docs/graph-api/reference/video, saying that this field is the "enum" type, no possible values, nor when to use it.
The point is that I get "ineligible" for videos that I have monetized before, and I wonder what does it mean, and how can I get status "eligible"?
Thanks
First, I understand GET requests should be safe and idempotent. However, my current situation is a little bit different from all the examples I have seen, so I'm not sure what to do.
The web app is some kind of metadata database for all online videos (by "all" I actually mean "all YouTube, Vimeo, XXX, ...", i.e., a known range of mainstream online video websites). Users can POST to http://www.example.com/api/video/:id to add metadata to a certain video, and GET from http://www.example.com/api/video/:id to get back all the current metadata for the given video.
The problem is how to get the video ID for a URL (say https://youtu.be/foobarqwe12). I think the users can query the server somehow, perhaps with a GET at http://www.example.com/api/find_video?url=xxx. The idea is that as long as the URL is valid, the query should always return the information of the video (including its ID); this seems to require that the server creates the record for a video if it doesn't exist yet.
My opinion is that although this seems to violate the safety and idempotence requirements for GET requests, it can also be seen as implementation detail (ideally there is a record for every video for every URL at the beginning of time, and lazily creating records on GETs is just a kind of optimization).
Nonsense, it doesn't violate anything.
If "every valid resource name" has a "valid representation", how that representation is manifested is an internal detail that's outside scope.
Your GET is idempotent. Just because you create a new row in a DB on first access doesn't make it not so.
When you GET /missingurl, you get a representation -- not a 404, but a 200 and some kind of result. This representation could also just be a templated boilerplate that all entities get (only with the URL linked filled in).
Whether you simply print some templated boilerplate, or create a row in the DB, the representation to the client is the same. They make the request, they get the representation -- all the time, all the same. That's idempotent. The fact "something happens" on the backend in an implementation detail hidden from the client.
I am trying to get information about the comments on youtube video. I need comment id and from the following stackoverflow answer- Youtube API v3 get comments, I tried using the CommentThreads endpoint. Just the snippet and video id throws error 400 - "Incompatible parameters specified in the request." How to find the value of
allThreadsRelatedToChannelId.
I could not find any details of how to find its value in any documentation or search result.
'allThreadsRelatedToChannelId' is the Channel Id of the Video.
For example this Rihanna video https://www.youtube.com/watch?v=HL1UzIK-flA&feature=player_embedded
Belongs to the channel 'RihannaVEVO' here https://www.youtube.com/channel/UC2xskkQVFEpLcGFnNSLQY0A
So 'allThreadsRelatedToChannelId' is the channel Id 'UC2xskkQVFEpLcGFnNSLQY0A'
Running the API request which just the channel Id will return all comments for the channel.
If like you say you wish to extract comments for the Video then you'll need to any include the 'VideoId' which in this case is 'HL1UzIK-flA'.
Not to confuse 'VideoId' with 'Id' which only returns comments for thread id.
API 3 params for the CommentThread.List are at developers.google.com/youtube/v3/docs/commentThreads/list
I'm trying to use Facebook GraphAPI 2.0 to fetch user's id, first_name, and the url of profile picture(with special size modifiers) with single request. Here are my attempts:
If simply ask for picture, we can use: "me/picture?redirect=0&height=200&type=square&width=200" ==>It's successful.
If ask batch of information without special requirement of picture, we use: "me?fields=id,picture,first_name" ==> It's also successful.
Now, combining the two together, I tried: "me?fields=id,first_name,picture.fields(redirect(0), type(square),width(100))" as instructed by https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0#reading (the paragraph of "Making Nested Requests"). It returns error...
Thanks for any advice. you can use GraphAPI Explorer to check: https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Did%2Cname&version=v2.0
You don't need the redirect parameter if you also query for other fields:
GET /me?fields=id,first_name,picture.type(square).width(200).height(200)
should do. Note that the format (max. witdth/height) is determined by the largest edge. For my profile pic for example the width/height was 140 when requesting 200 like above.