Get view and watch time history of any youtube video - youtube

Is it possible to find watch time and view history of any youtube video through youtube API ? If yes than how ? and if no, then please tell any alternative to it.thanks

Yes, you can do it through API. Just use the Videos: list of the YouTube Data API. Use statistics as your part parameter and just place the videoId of the video that you want to get in the id parameter.
Here is the sample request.
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?part=statistics&id=y64OsZNYhp0&_h=2&
And this is the response that you will get.
{
"kind": "youtube#videoListResponse",
"etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/qVhz5oG-YjkUw2MI_dGWHLSoyqw\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/tNAz0qXkqB5wXksK0L-_QxgvMKI\"",
"id": "y64OsZNYhp0",
"statistics": {
"viewCount": "1452334",
"likeCount": "11181",
"dislikeCount": "136",
"favoriteCount": "0",
"commentCount": "1865"
}
}
]
}
To get the watch time or duration of the video, include the contentDetails as your part to get the duration.
Here is the sample request for that.
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?part=contentDetails%252Cstatistics&id=y64OsZNYhp0&_h=10&

You can see limited statistics of videos on YouTube that aren't owned by you. To do this, click on the 'More' link underneath a video title and click 'Statistics.

Related

Specify voice in twilio actions json

In one of my situations I need to be able to specify the voice in the default initiation of the autopilot. I have a strange behavior. Despite the style sheet set to a particular voice, the default initiation is not using that voice. Instead it is using may be a default voice? I don't know. However when the next intent is detected the voice switches to the correct voice specified in the style sheet.
{
"actions": [
{
"say": "Hello , May I speak to Mr Peter ?"
},
{
"listen": true
}
]
}
My Style sheet
{
"style_sheet": {
"voice": {
"say_voice": "Polly.Raveena"
},
[...]
}
}

Firebase iOS notifications not received on device

We have two kind of firebase notifications, one with the notification field and one without (this field it's used by the system to display the banner).
The one with is always received, the one without is received for a certain row of attempts and then stops being received.
These are the payloads:
The one always being received:
{
"content_available": true,
"data": {
"pushCategory": "ALEXA",
"body": "body",
"message": "message",
"title": "status/update",
"updateStatus": {
"operationId": "7fc0e1ff-cc0d-4045-8b30-69710bf80c24",
"status": 0,
"action": "makecoffee",
"description": "",
"stock": {
"remaining": "91",
"threshold": "10",
"depletion": false
}
}
},
"notification": {
"title": "title",
"body": "body msg"
},
"apns": {
"headers": {
"apns-priority": "10"
}
},
"to": "----"
}
The one not being received randomly:
{
"content_available": true,
"data": {
"pushCategory": "ALEXA",
"body": "body",
"message": "message",
"title": "status/update",
"updateStatus": {
"operationId": "7fc0e1ff-cc0d-4045-8b30-69710bf80c24",
"status": 0,
"action": "makecoffee",
"description": "",
"stock": {
"remaining": "91",
"threshold": "10",
"depletion": false
}
}
},
"apns": {
"headers": {
"apns-priority": "10"
}
},
"to": "----"
}
The equivalent notification using directly the APNS servers and without the alert field is always received. (the alert field is the one that tells the system to display the banner)
I contacted the Firebase support but the issue in ongoing, do you know what could be the issue?
I've never used Firebase.
I'm not sure if apns-priority in your payload has an effect. I just don't know:
"apns": {
"headers": {
"apns-priority": "10"
}
},
I think you have to get rid of it and just use priority field itself. Let Firebase map the fields itself...
From Firebase docs, look for the description of the priority parameter and how it behaves differently for data vs notification :
Sets the priority of the message. Valid values are "normal" and
"high." On iOS, these correspond to APNs priorities 5 and 10.
By default, notification messages are sent with high priority, and
data messages are sent with normal priority. Normal priority optimizes
the client app's battery consumption and should be used unless
immediate delivery is required. For messages with normal priority, the
app may receive the message with unspecified delay.
When a message is sent with high priority, it is sent immediately, and
the app can display a notification.
The payload with data ends up ultimately with a firebase priority of "normal" which translates to apns-priority 5
For notification the firebase priority of "high" translates to apns-priority of 10
For more on apns-priority, see apns-docs
The priority of the notification. If you omit this header, APNs sets
the notification priority to 10.
Specify 10 to send the notification immediately.
Specify 5 to send the notification based on power considerations on
the user’s device.

iOS 14 Notification not show the image

Hi I develop on iOS and follow through this instruction
https://www.avanderlee.com/swift/rich-notifications/
and my "notification.apns" look like this
{
"Simulator Target Bundle": "com.xxxxxxxxxxxxxxxxx",
"aps": {
"category": "content_added_notification",
"alert": {
"title": "Photos",
"body": "Antoine added something new - take a look"
},
"mutable-content": 1
},
"image_url": "https://upload.wikimedia.org/wikipedia/commons/d/d5/Basketball_Ball_Icon.png"
}
And notification show like this.
What wrong with it??
Just reboot your device. It's another bug of new release I suppose

Notification service extension not come to device with api.sandbox.push.apple.com

I have an issue with Notification Service Extension on iOS 13. This issue is not always happen.
When I push a notification with mutable-content = 1, on development apple server ( api.sandbox.push.apple.com:443), Apple return success on my server, but no notification comes to my device. Sometimes it still comes, but very late, for example I push it at 9:00 AM, it comes to my device at 9:15 AM, and show exactly time (15 mins ago).
Is this an apple error or my error? If it's my error, how do I fix this? And if it's Apple's error, does it happen on real server (api.push.apple.com:443)?
Thanks!
"Mutable-content" should be inside "aps" dictionary
Try this if you are sending from apns server
{
"aps": {
"category": "content_added_notification",
"alert": {
"title": "Photos",
"body": "Antoine added something new - take a look"
},
"mutable-content": 1
},
"image_url": "https://www.example.com/image_url"
}
And this if you are sending from firebase
let dict = ["to": "SERVER-KEY",
"notification":["body":"body text",
"title":"notification text",
"category": "myNotificationCategory",
"mutable-content": true],
"data":[
"mediaUrl": "https://homepages.cae.wisc.edu/~ece533/images/airplane.png"
]]as [String:Any]

Apple watch real response data

Can you print and show me the output of this with real device I need to know the format of it.
- (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void (^)(WKUserNotificationInterfaceType))completionHandler
{
// This method is called when a remote notification needs to be presented.
// Implement it if you use a dynamic notification interface.
// Populate your dynamic notification interface as quickly as possible.
// After populating your dynamic notification interface call the completion block.
NSLog(#"%#",remoteNotification);
completionHandler(WKUserNotificationInterfaceTypeCustom);
}
This is the Payload response for the question
{
"aps": {
"alert": {
"body": "Test message",
"title": "Optional title"
},
"category": "myCategory"
},
"WatchKit Simulator Actions": [
{
"title": "First Button",
"identifier": "firstButtonAction"
}
],
"customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App."
}

Resources