To retrieve list of video feeds from a user from Google, include the init() method from this post. Then use the method below to get the title of the video and the URL. This sample code retrieves the video feed list of the logged-in user. To retrieve the list of video feeds for other users, check the user guide.
Google YouTube API lets users who want their web applications to be able to upload videos to the YouTube site as well as displaying the user’s uploaded videos. First things first. As the developer, you need to get a developer’s key. You need this to be able to perform write or upload video operations. Go over to this link. Once you have finished submitting your developer information, you need to register a product in order to get a developer key. Once you’ve finished registering, you actually also get a ClientID aside from the developer key. You need both of these two in your code.
To start with, we need to initialize a YouTubeService object which we use for account validation.
The setFormDetails() method sets two variables token and formUrl which are required values in your HTML form fields. The formUrl would serve as your action URL of the form tag while the token variable will be a hidden field. The action URL must also append a nexturl parameter in order for your browser to redirect it to that URL after upload is finished. Your HTML form field would look like this:
Within the setFormDetails() method, the YouTubeNamespace.CATEGORY_SCHEME lets you specify which Category the video will be set as. This method is purely manual. You can create your own form page with title, description and category that lets the user sets it according to his preference. Just make sure those values are not empty because as they are required by the YouTubeAPI.