YouTube API already watched time of video - google-api

I would like to get already watched time of YouTube video.
Example:
It is visible in UI, so it must be possible to get somehow. I checked https://developers.google.com/youtube/v3/docs/videos and https://developers.google.com/youtube/v3/docs/search, but this info doesn't seems to be at any of those two.

There is no API endpoint which returns how far along a user is in watching a video. The YouTube api is mostly a file store for videos it doesn't expose information about user progress in a video.

Related

YouTube Livestream Update Script

I've been searching here and across the web for a bash script that leverages the YouTube API to update the Title, Description, Playlist, Category and Thumbnail given a YouTube livestream video ID. My preference is to do this using bash/curl to keep it simple, but I've been unable to make any progress.
I've seen this question asked a few times, but the feedback given over the last couple years has been a redirect to the YouTube API documentation which I've gone through thoroughly, but have been unsuccessful in achieving the outcome described above.
Looking forward to any help you can provide.

Get currently playing video in Youtube

I need to get the title of the currently playing video in my Firefox browser from an external app using youtube API, or at least my last played video in my YT account. The goal is to get the name of the song i'm listening to and putting it in a file. I've got another app (using Discord API) that will read it and use it.
My first idea was to get the watch history, but this function was removed from the API since late 2016.
I managed to authentificate my Google application to access my own channel with Oauth 2.0, but from here I'm stuck. There don't seem to be any request that gets your own last watched video.
I also thought of a completely different way, by using a Firefox extension to get the title, but storing it and passing it to the other app will not be an easy thing (localStorage and sessionStorage are both in AppData folder, and my other app can't access it).
Does anybody know a way to do this? I'm starting to be kind of desperate.
I was looking for something similar and came across this in my search: Cross-Domain Cookies
Sharing cookies between 2 applications via a 3rd party might be of help here although it would complicate things.

Can a video be updated while insertion/upload is still in progress with the YouTube v3 API?

My .NET client application needs to upload a video for which the title, description and custom thumbnail are not available at upload time. This metadata becomes available to my application at an indeterminate time after upload begins.
When this metadata becomes available to my application, would it be possible for me to update the video even if the initial upload is still in progress? It seems as though it would be possible if I had the video ID. However, (as far as I can tell) the video ID is not made available to me until after the video is uploaded.
As of now, there's no mentioned way to do this!
A possible solution is to set the video to being "unlisted" or "private"
and then, after the upload finishes, push your information with a second request (update request).
YouTube could probably handle change requests during uploads, but as you mentioned, there's no way to receive the videoID prior to upload end.

how to show a youtube video into WP7 application?

I want to develop a WP7 application. In this one, I would like to get video from youtube. For example, videos of a channel.
So, I know, I need youtube API, but I don't find a simple example to subscribe a channel and receive the latest video...
Is it possible ?
Thanks in advance , have a nice day !
I think there are simple RSS feeds for each channel... If there are no RSS feeds, parse the HTML feed (e.g. http://www.youtube.com/user/nokia/feed)
To play youtube videos, see
http://mytoolkit.codeplex.com/wikipage?title=YouTube
WP7 currently doesn't have a standard media layer for YouTube videos and you need the YouTube app in order to be able to play those. Unless you want to work on a low level with the encoding format used by YouTube, but then again - you would have to implement a decoding service.
To play a youtube Video you need to use the WebBrowserTask and open the target URL in the browser; if the youtube app is installed, it will play, if not installed, it will prompt the user to install and then play.
How to subscribe ?
I don't think if it's possible to make that directly from your app...

Possible to play Youtube video in a wp7 app?

is it possible to play youtube videos in a wp7 application? I would guess you could retrieve the video file from the youtube api and Perhaps play it using a media element? Any suggestion, tips or resources would be appreciated.
That's a great question and really goes to the heart of YouTube's business model, YouTube's API and WP7 Integration.
Short answer: To a limited extend it could be possible to play low-quality videos in WP7.
The first question you should ask yourself is: "What is Google?" The answer is "An Ad serving company". The overwhelming majority of Google & YouTube's revenue stream comes exclusively from advertisements. If you were to take YouTube's content and serve it on your own website/app without any YouTube branding or ads, that would works against their financial business model.
The second question you should ask yourself is: "So how is iPhone showing YouTube videos? And WP7? Or YouTube website itself for that matter?". This goes into the heart of YouTube's media delivery system. YouTube publicly exposes multiple formats from their website. For example format #1 is H263, Format #6 is MPEG and Format #5 is the SWF/FLV content. You can read more about YouTube Formats in their official documentation.
And now, to answer your question. YouTube API only exposes thumbnail size videos for unauthorized 3rd parties and those could potentially be showed in WP7 in-app. However the video quality will be terrible if scaled up for more than 1/4 of the WP7 screen resolution.
I suggest you read through the GData YouTube developer guide for information on the API. I'll do a quick run-through of how to get to those public videos. Personally, I haven't been successful in getting these 3GP videos to work on WP7.
Open up the GData feed for top rated videos: http://gdata.youtube.com/feeds/api/standardfeeds/top_rated
from the < entry /> element find the < id /> element which should have a link to single video GData feed. I picked up this one: http://gdata.youtube.com/feeds/api/videos/dMH0bHeiRNg
find the < media:content /> elements with yt:format attributes.
< media:content url='http://www.youtube.com/v/dMH0bHeiRNg?f=videos&app=youtube_gdata' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='360' yt:format='5'/>
< media:content url='rtsp://v5.cache7.c.youtube.com/CiILENy73wIaGQnYRKJ3bPTBdBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='360' yt:format='1'/>
< media:content url='rtsp://v3.cache8.c.youtube.com/CiILENy73wIaGQnYRKJ3bPTBdBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='360' yt:format='6'/>
Open up "VLC Player" with format #6 URL and you should see the RTSP stream player.
** This whole post should be considered "As far as I know". This is all knowledge I gleamed from official YouTube documentation and forums.
Quoting from the Windows Phone Developer FAQ
How can I play youtube videos in my app?
Use the WebBrowserTask and open the target URL in the browser; if the youtube app is installed, it will play, if not installed, it will prompt the user to install and then play.
No, you can't play it via standard API methods. A similar question was asked before. WP7 currently doesn't have a standard media layer for YouTube videos and you need the YouTube app in order to be able to play those. Unless you want to work on a low level with the encoding format used by YouTube, but then again - you would have to implement a decoding service.

Resources