youtube cms performance report download api - youtube-api

We have a manual process to download the performance report from youtube cms application. This report is a csv or zip that is generated weekly and gives the "view" details for every video owned by the user at a daily level.
Is there an API to download this report ? I looked at the youtube analytics api and it looks like I have to get the data for each video individually. We have a lot of videos and this will be over the quota. Is there a way to get the weekly performance report through some api ?

The current YouTube Analytics API isn't well suited for performing bulk reporting for any significant volume of videos.
There's an open feature request that you can "Star" to be notified when there's an alternative approach available. I'm afraid that I don't have any timelines to share, but it's being actively worked on.

As Jeff pointed out before, you won't be able to download a performance report from Youtube CMS using Youtube Analytics API.
You can use mechanize module in python to log in to your youtube cms account and navigate to that download URL.
browser = mechanize.Browser()
browser.open('http://cms.youtube.com')
browser.select_form(nr = 0)
browser.form['Email'] = email
browser.form['Passwd'] = password
browser.submit()
browser.open(dashboard_url) //url that you get redirected to when you login
and then you can search for reports link. then click on that. then search for the report you want and download it.
more info here:
http://www.pythonforbeginners.com/cheatsheet/python-mechanize-cheat-sheet/
i was able to download reports that i want using this module in python.

Related

How to upload ebooks to Google Play Books using a script?

Both the Google Play books website and the Google Play books Android application, have the ability to upload your own ebooks. I wish to perform the same thing using a script written in python3 or nodejs.
I have taken a look at the API and, it seems that it is only for retrieving information about the various books.
I am wondering whether I'll have to achieve this using something like Google Chrome CDP to use the Goolge Play Books website itself to upload books or can this be done using the API and it's undocumented?
I was able to solve this.Automated uploading to Google play books by using the website itself via selenium and it's chrome driver.

How to have my site upload and link videos in users youtube accounts

I'd like to offer users the chance to share videos of their stories on my web app.
I'd prefer to have these videos posted in their YouTube accounts unless there is a great reason to have them in my apps account. We'll need to moderate the videos with volunteers.
It seems like the simplest thing that could work is:
1) Have my Web App Link to the YouTube Phone App. Maybe email a link so the interaction goes to their phone.
2) Have users make their Video using the YouTube phone app:
https://support.google.com/youtube/answer/57407
3) In my web app, use YouTube OAuth to find their video and set metadata.
OR
3) Have users copy/paste video URL back into my Web App. Maybe reply to the original email?
I'm concerned this UX is complicated. Is there a way to automate these interactions?
What's the simplest thing that could work using the available APIs?
Thanks!

Is it possible to host videos uploaded to my website on youtube?

I have Java based website. I would like users to log into my website and then upload videos to youtube using my youtube account. Users should not be required to have their own youtube account since videos will be uploaded using my youtube account.
Does youtube support this scenario?
If so, is there a sample code that shows me how to do this in Java?
I have used UploadVideo.java sample provided by google (https://developers.google.com/youtube/v3/code_samples/java#upload_a_video), but it requires users to log into youtube account using their id and password. That is not my use case.
Please study the terms and conditions of the Youtube service ; I think they do not allow this:
https://www.youtube.com/static?gl=GB&template=terms
YouTube accounts
4.1 In order to access some features of the Website or other elements of the Service, you will have to create a YouTube account. When
creating your account, you must provide accurate and complete
information. It is important that you must keep your YouTube account
password secure and confidential.
4.2 You must notify YouTube immediately of any breach of security or unauthorised use of your YouTube account that you become aware of.
4.3 You agree that you will be solely responsible (to YouTube, and to others) for all activity that occurs under your YouTube account.
and
5.1.L: you agree not to access Content or any reason other than your personal, non-commercial use solely as intended through and permitted
by the normal functionality of the Service, and solely for Streaming.
"Streaming" means a contemporaneous digital transmission of the
material by YouTube via the Internet to a user operated Internet
enabled device in such a manner that the data is intended for
real-time viewing and not intended to be downloaded (either
permanently or temporarily), copied, stored, or redistributed by the
user.
You can not let other people use your YouTube account/channel. The way to do is using YouTube Direct Lite
You basically add a ytdl with playlist tag while uploading videos.
You can check Android Client for how to do it in Java.
As to whether it is technically possible, yes, see https://developers.google.com/youtube/v3/guides/using_resumable_upload_protocol
The technical problem here is users will be able to delete videos too if they have your access token with full permissions. basically you need to:
load your html page with the upload interface.
add to the onclick event of the upload button to send an ajax request to a script on your server which will:
return the access token of your account to the client
soon thereafter change the access token using the refresh token
Its still technically vulnerable though. a possible solution is to obtain the access token ONLY with the scope:
https://www.googleapis.com/auth/youtube.upload
There is a very good chance it will not be vulnerable then. You should test it.

How to use the Youtube Analytics API to get the metric "earnings"?

I am a Youtube Partner and I have monetized videos on Youtube. Already receive a small monthly amount through some channels that have associated with my Google Adsense account.
Now, I would like to generate a report gathering the monetary values and views received from each channel.
I did the following question on Google Code, because I thought there was some problem in the API, but it happened that I was using the API incorrectly. See the link below.
http://code.google.com/p/gdata-issues/issues/detail?id=4826#makechanges
Now, I still could not make it work because I do not know where to find the requested data in the response I got from the link above.
Where do I find this CMS_ID? I have more than one channel, so I need to have each accepted as a Youtube Content Manager to use the API and retrieve the gains?
Someone here on Stack Overflow already managed to use the Youtube Analytics API using the metric "earnings"?
My code is in Python based on the example from Google here:
https://developers.google.com/youtube/analytics/v1/code_samples/python
I'm using the following scopes:
YOUTUBE_SCOPES = ["https://www.googleapis.com/auth/youtube.readonly",
"https://www.googleapis.com/auth/yt-analytics.readonly",
"https://www.googleapis.com/auth/youtubepartner",
"https://www.googleapis.com/auth/yt-analytics-monetary.readonly"]
As of right now, it's only possible to retrieve monetary information in YouTube Analytics API reports when those reports are run via the context of a content owner, as described in the documentation.
It is possible to have a monetized channel that is opted in for Google AdSense ads without having that channel managed by a content owner, in which case you would not be able to get those metrics via the YouTube Analytics API.
Let's use the issue you previously opened to track the request to open up this type of report to non-content owners as well, as that's a more appropriate place for feature requests than Stack Overflow.

How to allow users to upload video from my website to my youtube account?

Is it possible to allow uses to upload video to my youtube account with v3 api? I want allow users to upload video through my website to youtube but not ask them to login to their youtube account. I know it was possible in v2 api. Is it also doable in v3 api?
I've tried so hard to do the same thing as you /w the v3 API. The principal difficulty is to set our credentials in the code. With the v3 API, all the old login methods are "deprecated", to lead place to oAuth V2 login method.
In the API, i've didn't found a parameter where to set credentials. I hope you can find it. Let me know if this is the case.
If you success to create an httpClient object /w your credentials, this is perfect, the code is easy after doing this.
In the case you seach the right code for the v2 version : here
Good luck :)
I'm digging into this question now, too. So far, one workaround is to use the email upload option (found within Youtube's settings once logged in).
There's a limit of 25mb here so it's probably just a temporary proof of concept but powerful enough for smaller vids (mixed with FFMpeg tools wrapped for the language of your choice, I'm using Node.js http://www.benfarrell.com/2012/06/14/morph-your-media-with-node-js/)
Ideally, I want a user to upload a vid, store it in RAM, and then get it pushed to my youtube channel. We'll see what we find...

Resources