How to upload sound recording assets using YouTube API? - php

We have a CMS on YouTube. I am trying to write a PHP script using Youtube API that uploads sound recordings and creates assets based on these recordings.
I am reading the references on inserting assets in Google developers:
https://developers.google.com/youtube/partner/docs/v1/assets/insert
The example shown here is about uploading videos.
The following snippet shows how to create a video insert request.
// Create a request for the API's videos.insert method to create and upload the video.
$insertRequest = $youtube->videos->insert("status,snippet", $video,
array('onBehalfOfContentOwner' => $contentOwnerId,
'onBehalfOfContentOwnerChannel' => $channelId));
But i am not finding anything regarding creating an audio or sound recording insert request to be able to upload the recordings. So how to create insert sound recording insert requests instead of video?
Appreciate any help regarding this issue. Thank you

I think you are confused between assets and claims. In that example, you insert video for claim not for asset.
What you are asking is uploading a reference audio. Here's the full guide: https://developers.google.com/youtube/partner/asset_reference_upload_example

Related

Duplicate video when upload via youtube api

I'm using Youtube API v3 to upload video. At the first time I use, it requires authorization then do upload but there are two videos is created. They are exactly the same but there is no error, the API returns the latest id. I checked in my channel, two videos could be view.
When I try to upload the previous video, another id returns, too, but if I use this, Youtube will show me "This video is a duplicate of another video". Other times, the API works right. Did anyone encounter this problem?

Catching Duplicate Upload Error within YouTube API v3

At this time I'm able to upload Videos to my own YouTube channel on the back-end using API V3 with OAuth 2.0 seamlessly, the need I have is to notify users when they upload the same video twice. As far as I can see YouTube API V3 does not detects this issue until upload has finished. So this means that even if a video is a duplicated one, the upload will always succeed and then the YouTube interface will show the message: "ID Duplicated Video" to the right side of video list on my channel.
How can I read this info (ID Duplicated Video) through the API in PHP so that I can be able to notify user about this duplicated upload?
There is no interface to check if a user is uploading a duplicate video before uploading the entire file. Presumably, YouTube performs some kind of hash on the file after the upload has completed in order to check if it is a duplicate upload. Because the video file needs to be uploaded in its entirety for this check to happen, there is no way to check for a duplicate upload (currently) before an upload has completed.

Youtube API : Uploading the video more than once over YouTube (via api) doesn't provide any exception

Uploading the video more than once over YouTube (via api) doesn't provide any exception. Instead it returns the success in response.
YouTube response after uploading same video is given in this link:
https://bpaste.net/raw/5504d0129088
Videos: insert Uploads a video to YouTube and optionally sets
the video's metadata.
All it does is insert a video. It does not check that a video with that name or metadata or file doesn't already exist. That is the developers job. You can keep uploading the same video as many times as you like it will get a different id and YouTube will treat it as a different video.
In this instance you would only see an exception if the file did not upload correctly. The fact that you are not seeing an exception is as it should be.

Vimeo bulk upload and mysql match

I would like to know if on Vimeo PRO account i can use any method to store some info about a video in MySQL DB and match them with upload video.
The easiest thing i can guess is rename the video file with a random token and store it in my DB as primary key with video associated info, copy to dropbox the video and upload it.
But, as far as i know, it seems that uploaded video gets renamed,
I also need to do this in bulk on 2.000 videos.
Vimeo assigns each video a unique videoId. You can make a GET request to their API and pull a list of all videos with data on them. I built something similar.
We pull the video information and stored it in a table and used that table to populate a grid with the video data for a user to edit. Its described here: https://developer.vimeo.com/api/endpoints/videos#/{video_id}
Also check their vimeo google group for more information.

Is there a way to upload videos to youtube from our Website?

I am developing a website, where I am allowing users to upload videos, but if the members numbers keep on increasing and they keep on uploading more videos it will be expensive for me. So I want to upload the movies to youtube instead, is this possible?
By viewing some other posts here, I am thinking it is possible?
You need Youtube API to upload the videos with PHP.
There are some ready scripts you can use to upload to youtube, the one that deserves mention here is:
PHPTube
More Resources
Use the YouTube API with PHP
YouTube Uploader
In addition to Sarfraz's links you also have the Services_YouTube PEAR package and the Zend_Gdata_YouTube class. They are both very well documented.

Categories