Regexp, can't match many elements contained in an array (json) - ruby

I have trouble doing a regexp, and I don't know how to formulate the questions, so better than words, here is an example
String
"medias": [
{
"height": 800,
"id": "",
"origin": "google",
"thumbnail": {
"height": 94,
"url": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTF_KeDfHAxLuvCoYkuKUcwPKpxHfjt19g-E0uhsV20rLGf6VbJ--NFKCuO",
"width": 150
},
"title": "144779-cat-cats.jpg",
"type": "image",
"url": "https://lh4.googleusercontent.com/-bemqYIv9dPw/UTsFD0yJsBI/AAAAAAAAAZI/1zrKmdolPLY/s0-d/144779-cat-cats.jpg",
"width": 1280
},
{
"height": 300,
"id": "",
"origin": "google",
"thumbnail": {
"height": 94,
"url": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR60TwME2D02rjeROsOlHSMdk5AkrtwPwJIhsXBqoOoISUA95rXpKXihL4",
"width": 124
},
"title": "cats-in-sink.jpeg",
"type": "image",
"url": "https://lh4.googleusercontent.com/-zrZJg2qJQlI/Tg9kwdqbsrI/AAAAAAAAAEQ/Oal8KLLfItk/cats-in-sink.jpeg",
"width": 397
}
]
Regexp
"medias": \[
([{
"height": \d+[,|]
"id": ".*"[,|]
"origin": ".*"[,|]
"thumbnail": {
"height": \d+[,|]
"url": ".*"[,|]
"width": \d+[,|]
}[,|]
"title": ".*"[,|]
"type": ".*"[,|]
"url": ".*"[,|]
"width": \d+[,|]
}[,|]]*)[,|]
\][,|]
Just the middle part of the regexp, between (), works fine. but when I add the media wrapper around it gets broken.
"medias": \[
....................
....................
...........[,|]
\][,|]
Here you'll find the middle part matching
And here you'll find the complete regexp that is broken
Any Idea ?

Use the function json_decode() in php instead
$array = json_decode($json_object);

Related

Is there a way to figure out the right dimensions for images to be used on Adaptive cards for a MS teams app?

We are trying to create an bot with a use of Adaptive cards on MS-Teams. The preview using adaptive card designer gives the proper image as required. But when used in the Teams app, the image looks totally distorted.
The preview image as in designer:
The image output as in the MS teams app:
Below is the Json used for the adaptive cards:
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Howdy!",
"weight": "Bolder",
"color": "Accent",
"size": "Large"
},
{
"type": "TextBlock",
"text": "How are you doing today? ",
"wrap": true
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"url": "https://howdy1.blob.core.windows.net/sample/2-removebg-preview.png",
"selectAction": {
"type": "Action.Submit",
"data": {
"rating": "awful",
"comment": ""
},
"title": "awful"
},
"size": "Large",
"width": "700px",
"height": "60px"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"url": "https://howdy1.blob.core.windows.net/sample/3-removebg-preview.png",
"selectAction": {
"type": "Action.Submit",
"data": {
"rating": "bad",
"comment": ""
},
"title": "bad"
},
"size": "Large",
"width": "700px",
"height": "60px",
"spacing": "None"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"url": "https://howdy1.blob.core.windows.net/sample/1-removebg-preview.png",
"selectAction": {
"type": "Action.Submit",
"data": {
"rating": "ok",
"comment": ""
},
"title": "ok"
},
"size": "Large",
"width": "700px",
"height": "60px"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"url": "https://howdy1.blob.core.windows.net/sample/5-removebg-preview.png",
"selectAction": {
"type": "Action.Submit",
"data": {
"rating": "good",
"comment": ""
},
"title": "good"
},
"size": "Large",
"width": "700px",
"height": "60px"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"url": "https://howdy1.blob.core.windows.net/sample/4-removebg-preview.png",
"selectAction": {
"type": "Action.Submit",
"data": {
"rating": "terrific",
"comment": ""
},
"title": "terrific"
},
"size": "Large",
"width": "700px",
"height": "60px"
}
]
}
]
},
{
"type": "Input.Text",
"placeholder": "Add a comment",
"isMultiline": true,
"id": "comment"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.3",
"actions": [
{
"type": "Action.Submit",
"title": "OK",
"data": {
"rating": "",
"comment": ""
}
}
]}
Thanks in advance!!
Moving comment to answer :
This issue has been fixed, We have checked and its working fine. Attaching a piece of code for emoji height and width. Please keep the width inline with height.
{
"type": "AdaptiveCard",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"url": "https://howdy1.blob.core.windows.net/sample/2-removebg-preview.png",
"selectAction": {
"type": "Action.Submit",
"data": {
"rating": "awful",
"comment": ""
},
"title": "awful"
},
"size": "Large",
"width": "70px",
"height": "60px"
}
]
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.3",
}

Define tab order in Adaptive Cards for Microsoft BotFramework

tl;dr: How can we define the tab order of Adaptive Cards Input Elements?
Hi there,
we are using Adaptive Cards in a web chat project along with MS Bot Framework V4. We have e.g. one card, where you enter your address. We have two columns to show the input fields side-by-side in a 2x2 fashion:
Street | Number
Zip | City
That's how our customers would normally read it - from left to rights and the things in a row belong together. But as we are using columns, the tab order of the adaptive card is "wrong": it tabs through the column and then goes to the right column and tabs through there from top to bottom.
Is there a way to define the tab order or does anyone have an idea, how to keep the "layout" of the adaptive card but end up with the correct tab order?
Best regards
The solution was much easier, than I thought: I had to separate each row of the column set into several column sets, each being in its own container. Then the tab order is correct from left to right and then from top to bottom.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "**Address**",
"size": "Large",
"height": "stretch"
},
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "street*",
"spacing": "Large",
"height": "stretch",
"weight": "Bolder"
},
{
"type": "Input.Text",
"placeholder": "Street",
"id": "street",
"value": "{street}"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Number*",
"spacing": "Large",
"weight": "Bolder"
},
{
"type": "Input.Text",
"placeholder": "Number",
"id": "number",
"value": "{number}"
}
]
}
]
}
]
},
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Zip*",
"spacing": "Medium",
"weight": "Bolder"
},
{
"type": "Input.Text",
"placeholder": "Zip",
"id": "zip",
"value": "{zip}"
}
],
"spacing": "None",
"height": "stretch",
"horizontalAlignment": "Center"
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "City*",
"spacing": "Medium",
"weight": "Bolder"
},
{
"type": "Input.Text",
"placeholder": "City",
"id": "city",
"value": "{city}"
}
],
"horizontalAlignment": "Center",
"height": "stretch"
}
]
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Send"
}
]
}

can we add view more option in hero card for long messages

I am using Microsoft bot framework, is it possible to give option as view more for long messages in hero card.
my card is rendering and i am able to see the complete text. since text is very long chat bubble is not fitting in the window. i know we can split the text and send two times but my client is very specific about view more option.
Any help is appreciated.
Thanks
Sanjeev
Depending on the channels you are connected to. For example, on Facebook Messenger this is not feasible as the UI components allowed there do not have this option.
But for other channels that support Adaptive Cards like these Partners you might find other solutions like having dynamic Height for cards that will support having large texts and many other stuff.
UPDATE
I hope this helps as there isn't a "view more" option yet in Adaptive Cards, but there is a Toggle Option like below
Go to the Adaptive cards designer and paste the following (replacing original json) in the Card Payload Editor on the bottom left
After that click on Preview Mode on the top right and then click on the preview card, you will have a TOGGLE Action
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"selectAction": {
"type": "Action.ToggleVisibility",
"targetElements": [
"leg1Details"
]
},
"items": [
{
"type": "ColumnSet",
"columns": [
{
"width": "24px",
"items": [
{
"type": "Image",
"style": "Person",
"backgroundColor": "#0078D7",
"url": "http://messagecardplayground.azurewebsites.net/assets/smallairplane_white.png"
}
],
"type": "Column"
},
{
"width": "stretch",
"spacing": "Small",
"verticalContentAlignment": "Center",
"items": [
{
"type": "TextBlock",
"text": "**Depart:** Delta Air Lines flight 8471 to Paris"
}
],
"type": "Column"
}
]
},
{
"type": "ColumnSet",
"spacing": "None",
"columns": [
{
"width": "24px",
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"width": "1px",
"url": "http://messagecardplayground.azurewebsites.net/assets/palebluedot1x1.png",
"height": "20px"
}
],
"type": "Column"
},
{
"width": "stretch",
"spacing": "Small",
"items": [
{
"type": "TextBlock",
"text": "Bengaluru, Sun 11/12/2017 1:55 AM, 10 hours 41 minutes",
"isSubtle": true
}
],
"type": "Column"
}
]
}
]
},
{
"type": "ColumnSet",
"id": "leg1Details",
"isVisible": false,
"spacing": "None",
"columns": [
{
"width": "24px",
"padding": "none",
"backgroundImage": {
"url": "http://messagecardplayground.azurewebsites.net/assets/palebluedot1x1.png",
"mode": "repeatVertically",
"horizontalAlignment": "Center"
},
"type": "Column"
},
{
"width": "stretch",
"spacing": "Small",
"items": [
{
"type": "Container",
"padding": {
"top": "default"
},
"items": [
{
"type": "ColumnSet",
"columns": [
{
"width": 45,
"items": [
{
"type": "Container",
"padding": "none",
"backgroundImage": "http://messagecardplayground.azurewebsites.net/assets/TxP_Background.png",
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "http://messagecardplayground.azurewebsites.net/assets/TxP_Flight.png"
}
]
},
{
"type": "Container",
"style": "emphasis",
"spacing": "None",
"items": [
{
"type": "TextBlock",
"text": "Flight to Paris",
"wrap": true,
"size": "ExtraLarge",
"weight": "Lighter",
"color": "Accent"
},
{
"type": "TextBlock",
"text": "Delta Air Lines flight 8471",
"wrap": true,
"size": "Medium",
"spacing": "Small"
},
{
"type": "TextBlock",
"wrap": true,
"text": "Confirmation code: ABCDEF",
"size": "Medium",
"spacing": "None"
},
{
"type": "TextBlock",
"wrap": true,
"text": "10 hours 45 minutes",
"size": "Medium",
"spacing": "None"
}
]
}
],
"type": "Column"
},
{
"width": 55,
"spacing": "None",
"padding": "default",
"items": [
{
"type": "Container",
"height": "stretch",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"width": "auto",
"items": [
{
"type": "TextBlock",
"text": "BLR",
"weight": "Lighter",
"size": "ExtraLarge"
}
],
"type": "Column"
},
{
"width": "stretch",
"verticalContentAlignment": "Center",
"items": [
{
"type": "Image",
"width": "10000px",
"url": "http://messagecardplayground.azurewebsites.net/assets/graydot2x2.png",
"height": "2px"
}
],
"type": "Column"
},
{
"width": "auto",
"spacing": "Small",
"verticalContentAlignment": "Center",
"items": [
{
"type": "Image",
"url": "http://messagecardplayground.azurewebsites.net/assets/smallairplane.png",
"height": "16px"
}
],
"type": "Column"
},
{
"width": "auto",
"items": [
{
"type": "TextBlock",
"text": "CDG",
"weight": "Lighter",
"horizontalAlignment": "Right",
"size": "ExtraLarge"
}
],
"type": "Column"
}
]
},
{
"type": "ColumnSet",
"columns": [
{
"width": 1,
"items": [
{
"type": "TextBlock",
"text": "1:55 AM",
"size": "Medium"
}
],
"type": "Column"
},
{
"width": 1,
"items": [
{
"type": "TextBlock",
"text": "8:10 AM",
"horizontalAlignment": "Right",
"size": "Medium"
}
],
"type": "Column"
}
]
},
{
"type": "ColumnSet",
"spacing": "None",
"columns": [
{
"width": 1,
"items": [
{
"type": "TextBlock",
"isSubtle": true,
"wrap": true,
"text": "November 12, 2017"
}
],
"type": "Column"
},
{
"width": 1,
"items": [
{
"type": "TextBlock",
"isSubtle": true,
"wrap": true,
"text": "November 12, 2017",
"horizontalAlignment": "Right"
}
],
"type": "Column"
}
]
},
{
"type": "ColumnSet",
"spacing": "None",
"columns": [
{
"width": 1,
"items": [
{
"type": "TextBlock",
"isSubtle": true,
"text": "Bengaluru"
}
],
"type": "Column"
},
{
"width": 1,
"items": [
{
"type": "TextBlock",
"isSubtle": true,
"text": "Paris",
"horizontalAlignment": "Right"
}
],
"type": "Column"
}
]
}
]
},
{
"type": "ColumnSet",
"horizontalAlignment": "Right",
"separator": true,
"spacing": "Large",
"columns": [
{
"width": "auto",
"selectAction": {
"type": "Action.OpenUrl",
"url": "http://www.microsoft.com"
},
"items": [
{
"type": "ColumnSet",
"columns": [
{
"width": "auto",
"verticalContentyAlignment": "center",
"items": [
{
"type": "Image",
"url": "http://messagecardplayground.azurewebsites.net/assets/smallairplane.png",
"height": "16px"
}
],
"type": "Column"
},
{
"width": "auto",
"spacing": "Small",
"items": [
{
"type": "TextBlock",
"text": "Check in"
}
],
"type": "Column"
}
]
}
],
"type": "Column"
},
{
"width": "auto",
"spacing": "Large",
"selectAction": {
"type": "Action.OpenUrl",
"url": "http://www.microsoft.com"
},
"items": [
{
"type": "ColumnSet",
"columns": [
{
"width": "auto",
"verticalContentyAlignment": "center",
"items": [
{
"type": "Image",
"url": "http://messagecardplayground.azurewebsites.net/assets/calendaricon.png",
"height": "16px"
}
],
"type": "Column"
},
{
"width": "auto",
"spacing": "Small",
"items": [
{
"type": "TextBlock",
"text": "View in Calendar"
}
],
"type": "Column"
}
]
}
],
"type": "Column"
}
]
}
],
"type": "Column"
}
]
}
]
}
],
"type": "Column"
}
]
}
]}

Search API Call Returns Results Outside The Specified ChannelID

I have a YT API search query that is limited to a specific channel but returns results outside that channel which is an issue.
Give an through scouring of this https://developers.google.com/youtube/v3/docs/search/list the following request was done.
https://content.googleapis.com/youtube/v3/search?part=snippet&channelId=UCoMurV7497Rj7kk5i-UXUhg&q=%E0%A4%A4%E0%A4%B5%E0%A4%BE&key={your key}
Just to be clear the 'q' parm is Hindi and translates to "तवा"
In the results there are items that are not from the channel specified in the channelId in the request. This seems to be a bug in the YT API.
200
Show headers -
{
"kind": "youtube#searchListResponse",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/hJ1ihb5XsXgS7tq9QigswU-SsUg\"",
"regionCode": "US",
"pageInfo": {
"totalResults": 4,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/9R-AWbPk35j_zGJcL7wemicat9g\"",
"id": {
"kind": "youtube#video",
"videoId": "GfNUaVFmxaY"
},
"snippet": {
"publishedAt": "2014-05-26T11:16:17.000Z",
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Introduction to Plumbing Tools (Part-1) (Hindi) (हिन्दी)",
"description": "This video will help you understand plumbing tools. इस पाठ में आप नल साजी (प्ल्म्बींग) में इस्तेमाल होनेवाल...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/GfNUaVFmxaY/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/GfNUaVFmxaY/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/GfNUaVFmxaY/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "SkillTrain",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/kcnTk-acx88HM9_HoWokq8FRONI\"",
"id": {
"kind": "youtube#video",
"videoId": "swmvPyzi_3c"
},
"snippet": {
"publishedAt": "2017-12-23T15:00:06.000Z",
"channelId": "UCH4Bz5Swatl5iHSuCT_Hlxg",
"title": "पैन: जंगली के महान भगवान - (ग्रीक पौराणिक कथाओं में बताया)",
"description": "आज हम कम देवताओं में से एक है और मेरे पसंदीदा में से एक पर एक नज़र डालें, जंगली के परमेश्वर पैन। आप पौराणिक कथाओं और लोक-साहित्य का आनंद लें और अधिक जानने के लिए चाहते हैं।",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/swmvPyzi_3c/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/swmvPyzi_3c/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/swmvPyzi_3c/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Mythology & Fiction Explained",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/qE49UjY2s7xfzQc3lgM2V2089Cs\"",
"id": {
"kind": "youtube#video",
"videoId": "tjW1mKwNUSo"
},
"snippet": {
"publishedAt": "2014-11-25T17:00:03.000Z",
"channelId": "UCjmJDM5pRKbUlVIzDYYWb6g",
"title": "पान - आधिकारिक टीज़र ट्रेलर [HD]",
"description": "ह्यूग जैकमैन, गैरेट Hedlund, रूनी मारा और पैन में लेवी मिलर स्टार, थिएटर में 9 वीं अक्टूबर! http://www.pan-movie.com/ ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/tjW1mKwNUSo/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/tjW1mKwNUSo/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/tjW1mKwNUSo/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Warner Bros. Pictures",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/-zDpouVDxXZOX5hD6tlEcP9BeEM\"",
"id": {
"kind": "youtube#video",
"videoId": "vjGM6eLR5ZE"
},
"snippet": {
"publishedAt": "2017-12-10T05:52:59.000Z",
"channelId": "UCOvw0-6WFFEMr__v4mFonxQ",
"title": "गोकू खो पान | अंग्रेजी डब",
"description": "जबकि गोकू, पिकोलो, और Chichi उसे खोजने की कोशिश पान पुलाव के साथ एक साहसिक है। #ड्रेगन बॉल सुपर।",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/vjGM6eLR5ZE/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/vjGM6eLR5ZE/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/vjGM6eLR5ZE/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "GOT-two",
"liveBroadcastContent": "none"
}
}
]
}
I can't say for sure whether it is a bug or not, but, you're getting results from different channels due to the q parameter and its value - that's the intended functionality.
The q parameter search also in the description of the video.
So, if you want exclude results from other channels in your request you can do this:
If you really need add a search term, add it and add the name of your channel.
Example:
q=तवा + SkillTrain
You can test this request in this demo at Google API Explorer.
And these are the results:
{
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "GfNUaVFmxaY"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Introduction to Plumbing Tools (Part-1) (Hindi) (हिन्दी)"
}
}
]
}
In this case, there is one result that matched with both, your channel_id and the supplied Hindi character.
or
If you don't need add a search parameter, omit it from your request and (since you had added the channel_id value), once made the request, you'll get the following results:
{
"nextPageToken": "CAUQAA",
"pageInfo": {
"totalResults": 666,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "td3GPjcXPb4"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Basic components of a window AC (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "e611N5gR1z4"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Wheel balancing (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "XCitxJ-jvgQ"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Auto Clave (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "8zHSEv_tziQ"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Understanding the components of a split AC (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "WQ8X3hDIwJM"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Brake pad replacement (Hindi)(हिन्दी)"
}
}
]
}
All these results are from the provided channel_id.
You can test this request in this demo at Google API Explorer.

Playlist from YouTube Live Channel using API

I have an application that uses YoutTube API to search videos, channels, playlist ... all that working well but I can't get a reasonable playlist from the Live Channel. A query like (where UC4R8DWoMoI7CAwX8_LjQHig is the proper live channel id)
https://www.googleapis.com/youtube/v3/playlists?key=[key]&channelId=UC4R8DWoMoI7CAwX8_LjQHig&maxResults=50&part=snippet
returns 8 items of which 7 are garbage and have nothing to do with what you get on the live channel page (https://www.youtube.com/channel/UC4R8DWoMoI7CAwX8_LjQHig). Only the "Featured Live Streams" is correct (and when I get video from that playlist, it's the correct list as well)
Thanks
Actual reponse (expected is in the youtube link)
{
"kind": "youtube#playlistListResponse",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/PGP_FpovX1KsZOhAe4--innaNE4\"",
"pageInfo": {
"totalResults": 8,
"resultsPerPage": 50
},
"items": [
{
"kind": "youtube#playlist",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/kW1-C1oUikh3IyLtK9hUbzQnl0s\"",
"id": "PLU12uITxBEPHl8dr4q9BhPRINfLyVjAWY",
"snippet": {
"publishedAt": "2019-01-24T23:04:32.000Z",
"channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
"title": "Democratic Response to State of the Union",
"description": "",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/IhrFBb3gTWo/default_live.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/IhrFBb3gTWo/mqdefault_live.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/IhrFBb3gTWo/hqdefault_live.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/IhrFBb3gTWo/sddefault_live.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/IhrFBb3gTWo/maxresdefault_live.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "Live",
"localized": {
"title": "Democratic Response to State of the Union",
"description": ""
}
}
},
{
"kind": "youtube#playlist",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/of3sxCwj88Q-V9bYX_zkeBP_75M\"",
"id": "PLU12uITxBEPETz20Ie4iFYT_EZaCKsdpi",
"snippet": {
"publishedAt": "2019-01-24T23:01:42.000Z",
"channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
"title": "State of the Union",
"description": "",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/JUCekz5k9E4/default_live.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/JUCekz5k9E4/mqdefault_live.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/JUCekz5k9E4/hqdefault_live.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Live",
"localized": {
"title": "State of the Union",
"description": ""
}
}
},
{
"kind": "youtube#playlist",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/Nt5Y1fYQXsFYZ3TZbNkcakzPVww\"",
"id": "PLU12uITxBEPGYGDNfvikX90tRyzn7eZh-",
"snippet": {
"publishedAt": "2018-11-06T19:06:45.000Z",
"channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
"title": "Election Night Coverage",
"description": "",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/pvHba1WE8gI/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/pvHba1WE8gI/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/pvHba1WE8gI/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Live",
"localized": {
"title": "Election Night Coverage",
"description": ""
}
}
},
{
"kind": "youtube#playlist",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/vQKgmRlQrEbwNNkxis7_W9sOlGg\"",
"id": "PLU12uITxBEPF8XZZj4LudutrjxKqh_gtQ",
"snippet": {
"publishedAt": "2018-08-13T15:56:11.000Z",
"channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
"title": "Featured Live Streams",
"description": "",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/_s1sfxe3zck/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/_s1sfxe3zck/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/_s1sfxe3zck/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Live",
"localized": {
"title": "Featured Live Streams",
"description": ""
}
}
},
{
"kind": "youtube#playlist",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/RbBAgFqfGvYAN6b9rfOfIUPNrAY\"",
"id": "PLU12uITxBEPFcmBzhqA_w3_SAfcGCbUIp",
"snippet": {
"publishedAt": "2018-05-18T17:58:37.000Z",
"channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
"title": "The Royal Wedding",
"description": "",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/N42MQJX4KoY/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/N42MQJX4KoY/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/N42MQJX4KoY/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/N42MQJX4KoY/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/N42MQJX4KoY/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "Live",
"localized": {
"title": "The Royal Wedding",
"description": ""
}
}
},
{
"kind": "youtube#playlist",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/rl0pUnKm2ddu0YveTBYRKgSysNI\"",
"id": "PLU12uITxBEPEjt5-ijGeP_UcVM_RvFr1p",
"snippet": {
"publishedAt": "2018-04-13T22:30:05.000Z",
"channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
"title": "Coachella 2018",
"description": "",
"thumbnails": {
"default": {
"url": "http://s.ytimg.com/yts/img/no_thumbnail-vfl4t3-4R.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "http://s.ytimg.com/yts/img/no_thumbnail-vfl4t3-4R.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "http://s.ytimg.com/yts/img/no_thumbnail-vfl4t3-4R.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Live",
"localized": {
"title": "Coachella 2018",
"description": ""
}
}
},
{
"kind": "youtube#playlist",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/lgIUABP5PW7-bCHyVOpPkXxCt6Y\"",
"id": "PLU12uITxBEPGPUMSYceO0ywrY63AOqTU7",
"snippet": {
"publishedAt": "2018-04-13T22:30:05.000Z",
"channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
"title": "Coachella 2018",
"description": "",
"thumbnails": {
"default": {
"url": "http://s.ytimg.com/yts/img/no_thumbnail-vfl4t3-4R.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "http://s.ytimg.com/yts/img/no_thumbnail-vfl4t3-4R.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "http://s.ytimg.com/yts/img/no_thumbnail-vfl4t3-4R.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Live",
"localized": {
"title": "Coachella 2018",
"description": ""
}
}
},
{
"kind": "youtube#playlist",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/rjBqMP7cQCCrlypBDI4uLoP7IJk\"",
"id": "PLU12uITxBEPF6MjThhpt24z9kpQGLcO7J",
"snippet": {
"publishedAt": "2018-04-13T22:30:05.000Z",
"channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
"title": "Coachella 2018",
"description": "",
"thumbnails": {
"default": {
"url": "http://s.ytimg.com/yts/img/no_thumbnail-vfl4t3-4R.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "http://s.ytimg.com/yts/img/no_thumbnail-vfl4t3-4R.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "http://s.ytimg.com/yts/img/no_thumbnail-vfl4t3-4R.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Live",
"localized": {
"title": "Coachella 2018",
"description": ""
}
}
}
]
}

Resources