Youtube API - How to send direct messages to followers? - youtube

According to google support:
Use Messages to send private messages to other members of the YouTube
community. [...] The messages system utilizes Google+
messaging so your channel must be connected with a Google+ in order to
use this feature.
https://support.google.com/youtube/answer/57955?hl=en
Is it possible to send direct messages to followers via youtube or google plus API?

I think the closest thing that's currently implemented is the Subscriptions resource, which
"contains information about a YouTube user subscription. A
subscription notifies a user when new videos are added to a channel or
when another user takes one of several actions on YouTube, such as
uploading a video, rating a video, or commenting on a video." [source]
So your subscribers should be getting a notification when you upload a video or do something similar anyways. If you wanted to message each of them directly, I suppose you could use Subscriptions.list() with mySubscribers to get your list of subscribers, but I don't think there's a way to mass message them programmatically (seems like it could be easily abused).

Related

Is there a function to view donation information via YouTube Data API?

I am hoping to pull live stream donation information every 5 minutes onto my server. I am making a script to check that information for the names of the crew and send them payments automatically. Is there a way with the YouTube Data API to handle donation information?
None of the YouTube apis support this functionality. The main issue is that the YouTube apis are more then ten years old. They just give you basic access to the videos on YOuTube.
What you are looking for would be access to data used in the YouTube web app that being donations which is a relatively new future, and again part of the web app. Not just video data. Its just not something YouTube has released an api for yet.
Try and submit a feature request Issue tracker
As DalmTo mentioned, the YouTube Data API v3 doesn't have such feature.
However I recommend you to try out my open-source YouTube operational API. Indeed by requesting https://yt.lemnoslife.com/lives?part=donations&id=VIDEO_ID you will get in item["donations"] the donations currently displayed in the YouTube live chat. Especially may interest you:
Donation timestamp: donation["timestampUsec"] (example: 1654111675007219)
Donator channel id: donation["authorExternalChannelId"] (example: UC_PkX-rSBPWJqoK2zRRalfQ)
Donation amount: donation["purchaseAmountText"]["simpleText"] (example: 100,00\u00a0$US)
Donation message: donation["message"]["runs"][0] (example: FOR JUSTICE!)

How do I get the bot to send embed message when a new video is posted?

I'm trying to use the YouTube API to get my discord bot to send me a message when I post a new video, but since I'm a beginner I do not know how to do this. The idea is that it looks like this: http://prntscr.com/j8je80 , the embed is ready but the api part of youtube is still missing.
You needed to subscribe to push notification.
The YouTube Data API (v3) supports push notifications via
PubSubHubbub, a server-to-server publish/subscribe protocol for
Web-accessible resources. Notifications are pushed out to subscribers
via HTTP webhooks, which is much more efficient than polling-based
solutions. With PubSubHubbub, your server finds out about events in
near real-time, without having to determine the optimal polling
interval or repeatedly fetching data that hasn’t changed.
So these are the following activities that will trigger the push notification:
uploads a video
updates a video's title
updates a video's description
To be able to implement these, there is a step by step explanation on how to subscribe.

Can I use YouTube API to enable YouTube Live Streaming?

I'm developing a YouTube live streaming related program. I know there're APIs to create/list/delete broadcasts and live streams. But all these are assuming that YouTube Live Streaming is already enabled on your account.
I tried to but failed to find any API with which I can use to enable YouTube live streaming on my account. Is there such an API?
As far as I can tell, there is not. As you can see here: https://support.google.com/youtube/answer/2474026?hl=en, in order to create live events on youtube an account must be verified and in good standing.
If you are making the API requests using a YouTube account that fulfills these requirements you can use the YouTube Data API to create liveBroadcasts, otherwise you will likely receive an insufficientPermissions error. This error is detailed here: https://developers.google.com/youtube/v3/live/docs/errors#youtube.liveBroadcasts.insert-insufficientPermissions-liveStreamingNotEnabled-permission.userNotEnabled
One potential way you could tell if an account is able to create live events programmatically would be to call the channels.list() method, and return the status. The status of the channels will have status.longUploadStatus. Long uploads also require an account to be verified and in good standing, so if this value returns allowed you likely have the permissions to work with live events. More details of this can be found in the YouTube Data API documentation.
Let me know if you find information to the contrary.

Tracking subs referral

Is it possible using the current APIs to track where one's subscribers are subscribing from?
For example perhaps I want to see how many subscribers an annotation on a certain video (that any user uploaded) generated for my channel.
The closest thing to what you're describing is running a YouTube Analytics API report with
ids=channel==UC...
dimensions=video
metrics=subscribersGained,subscribersLost
sort=-subscribersGained
This will return the top ten videos that led to subscriptions to your channel. But I don't think that videos uploaded in third-party channels that have annotations prompting people to subscribe to your channel will show up on that list. My understanding is that only videos in your own channel will show up on the list, and it might be that only subscriptions made via the Subscribe link on the web page (not via an annotation) would trigger inclusion on that report.
Sorry that I don't have more specific details.

Does the Youtube API return list of users that have watched my video?

I'd like to create a Youtube app that rewards users after they have watched a certain number of my Youtube-channel's videos - or that rewards "experience points" based on the amount of time spent watching my channel.
Can I query the Youtube API to see if an authenticated user has watched a specific video associated with the app?
Seems like I can query against "likes" and "dislikes" - but curious if anyone has tracked "watch-time" or just "watched" in general.
My hesitation here is that I don't want access to a user's full history - I'd like a very unobtrusive approach to connecting authenticated users to specific video content.
I'm not seeing an API endpoint for querying or notifying if an associated Youtube video has been seen. Any help you can provide would be very helpful!
Considering user privacy I don't think you can acces this information. If you search through the API, you'll find that Youtube does come with insights, like viewcount and even demographic information.
It might be a solution to embed your videos in your app and then track which users watch that specific video within the app.
Inside your app catch the the onStateChange event to log that a user viewed a video. It will only work for video they view from inside your app.

Resources