Playlist from YouTube Live Channel using API - youtube-data-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": ""
}
}
}
]
}

Related

how can i query deep image relation with strapi

i'm having a problem with querying strapi
i create a relation but i can't reach the image of it and i don't how to do it even after reading the docs
thanks for helping me
here is my query "localhost:1337/api/projects?populate=*"
my response is like this
{
"data": [
{
"id": 1,
"attributes": {
"Title": "Booki",
"Href": "https://www.matt3806.github.io/OC_webdev_P2/",
"Description": "**Intégration d'une maquette** pour Booki, une startup fictive de manière **responsive** afin que le site puisse s'adapter à chaque taille d'écran",
"createdAt": "2022-11-24T08:03:27.891Z",
"updatedAt": "2022-11-24T08:35:02.452Z",
"publishedAt": "2022-11-24T08:03:31.712Z",
"Image": {
"data": [
{
"id": 21,
"attributes": {
"name": "booki desktop (2).png",
"alternativeText": "présentation sur ordinateur ",
"caption": null,
"width": 500,
"height": 500,
"formats": {
"thumbnail": {
"name": "thumbnail_booki desktop (2).png",
"hash": "thumbnail_booki_desktop_2_7205c44bca",
"ext": ".png",
"mime": "image/png",
"path": null,
"width": 156,
"height": 156,
"size": 18.48,
"url": "/uploads/thumbnail_booki_desktop_2_7205c44bca.png"
}
},
"hash": "booki_desktop_2_7205c44bca",
"ext": ".png",
"mime": "image/png",
"size": 81.79,
"url": "/uploads/booki_desktop_2_7205c44bca.png",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2022-11-24T08:02:04.171Z",
"updatedAt": "2022-11-24T08:02:21.446Z"
}
}
]
},
"technos": {
"data": [
{
"id": 1,
"attributes": {
"Name": "HTML5",
"createdAt": "2022-11-23T09:18:58.933Z",
"updatedAt": "2022-11-23T10:04:55.583Z",
"publishedAt": "2022-11-23T09:19:04.765Z"
}
},
{
"id": 2,
"attributes": {
"Name": "CSS3",
"createdAt": "2022-11-23T09:22:22.457Z",
"updatedAt": "2022-11-23T10:03:29.101Z",
"publishedAt": "2022-11-23T09:22:24.926Z"
}
}
]
}
}
},
my technos normaly have an image but it doesn't appear
do you know how to do it specifying the query may be ?
there is two options, easiest use strapi-plugin-populate and
api/projects?populate=deep
The more advanced one is to use qs
const str = qs.stringify(
{
populate: { technos: { populate: ["media"] } }
},
{ encodeValuesOnly: true }
);

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",
}

Automatically giving tags to image for a search function

I play a game which uses skins, around 200'000 of them and the players struggle to find them since there isn't really a search function other than random names.
Each skin has a name chosen by the users who upload them and that's it, others don't know about it untill they see it used by someone else.
I made some tools to make it easier and I wanted to implement a search by tag function, for example you search "dog" and it gives you the skins containing dogs. Is there a program able to automatically give tags to 200k images?
Game: https://Gota.io
My "tool"(badly made website) https://specy.it/SkinGallery.html
And the extension for the game: https://www.dropbox.com/s/36w6dkz22pxksrz/Extension.js?dl=0
This is not my specialty and it's an evolving field, but for the time being there are "image recognition as a service" services such as Google Vision whose rest API you can use to have the machine tag your image according to what it sees.
That being said, I'm not sure if your skins are suit for a good result. If we try it on the "dead mickey" skin, we get:
Well yeah, there's an animal, I guess. If you look at the "labels" tab you'd see it describes mostly colors, but it also mentions "fictional character" in the 12th place or so.
Depending on the skin, different contexts could suit you better. For example, if you use Sage Mode Naruto, Objects, Labels and Logos bring very little information, but Web tab says:
How would you handle the response of the rest service? Well, it's a JSON with the form:
{
"cropHintsAnnotation": {
"cropHints": [...]
},
"fullTextAnnotation": {
"pages": [
{
"blocks": [...],
"height": 512,
"property": {
"detectedLanguages": [
{
"confidence": 0.88,
"languageCode": "en"
}
]
},
"width": 512
}
],
"text": "SUH DUDE\n.\n"
},
"imagePropertiesAnnotation": {
"cropHints": [...],
"dominantColors": {
"colors": [...]
}
},
"labelAnnotations": [
{
"description": "Illustration",
"mid": "/m/01kr8f",
"score": 0.8927454,
"topicality": 0.8927454
},
{
"description": "Cartoon",
"mid": "/m/0215n",
"score": 0.8583309,
"topicality": 0.8583309
},
{
"description": "Circle",
"mid": "/m/01vkl",
"score": 0.70432633,
"topicality": 0.70432633
},
{
"description": "Art",
"mid": "/m/0jjw",
"score": 0.6253477,
"topicality": 0.6253477
},
{
"description": "Clip art",
"mid": "/m/03g09t",
"score": 0.5876344,
"topicality": 0.5876344
},
{
"description": "Fictional character",
"mid": "/m/02h7lkt",
"score": 0.52791756,
"topicality": 0.52791756
}
],
"localizedObjectAnnotations": [...],
"logoAnnotations": [...],
"description": "Los Angeles Rams",
"mid": "/m/06x76",
"score": 0.5958965
}
],
"safeSearchAnnotation": {
"adult": "VERY_UNLIKELY",
"medical": "VERY_UNLIKELY",
"racy": "VERY_UNLIKELY",
"spoof": "VERY_UNLIKELY",
"violence": "VERY_UNLIKELY"
},
"textAnnotations": [...],
{
"boundingPoly": {
"vertices": [
{
"x": 182,
"y": 40
},
{
"x": 295,
"y": 40
},
{
"x": 295,
"y": 111
},
{
"x": 182,
"y": 111
}
]
},
"description": "SUH DUDE\n.\n",
"locale": "en"
},
{
"boundingPoly": {
"vertices": [
{
"x": 182,
"y": 44
},
{
"x": 222,
"y": 43
},
{
"x": 223,
"y": 66
},
{
"x": 183,
"y": 67
}
]
},
"description": "SUH"
},
{
"boundingPoly": {
"vertices": [
{
"x": 237,
"y": 42
},
{
"x": 294,
"y": 40
},
{
"x": 295,
"y": 64
},
{
"x": 238,
"y": 66
}
]
},
"description": "DUDE"
},
{
"boundingPoly": {
"vertices": [
{
"x": 194,
"y": 101
},
{
"x": 196,
"y": 100
},
{
"x": 200,
"y": 111
},
{
"x": 198,
"y": 111
}
]
},
"description": "."
}
"webDetection": {
"bestGuessLabels": [
{
"label": "cartoon"
}
],
"pagesWithMatchingImages": [
{
"pageTitle": "edit #anime #naruto #foryou #foryoupage #narutouzumaki ... - TikTok",
"partialMatchingImages": [
{
"url": "https://p16.muscdn.com/obj/tos-maliva-p-0068/b27c516d2faee4174d0e4a26b7a3d466"
}
],
"url": "https://www.tiktok.com/#sakura._.haruno_editz/video/6777103057055517958?lang=en"
},
{
"pageTitle": "Originalton - edix_official TikTok Music Videos • TikyToky",
"partialMatchingImages": [
{
"url": "https://p16.muscdn.com/obj/tos-maliva-p-0068/b27c516d2faee4174d0e4a26b7a3d466"
}
],
"url": "https://tikytoky.com/music/originalton-6768700410359302918"
},
{
"pageTitle": ".... Wanna gain tons of followers? Follow #dragonballexclusives ...",
"partialMatchingImages": [
{
"url": "https://scontent-frt3-1.cdninstagram.com/vp/cdb9be9aa9707b90d55564a965668b7c/5E881986/t51.2885-19/s150x150/71524634_2513191889001976_2699215275693178880_n.jpg?_nc_ht=scontent-frt3-1.cdninstagram.com"
}
],
"url": "https://www.mystalk.net/detail/1917580489812869720_7212599026"
},
{
"pageTitle": "edit #anime #naruto #foryou #foryoupage #narutouzumaki ... - TikTok",
"partialMatchingImages": [
{
"url": "https://p16.muscdn.com/obj/tos-maliva-p-0068/b27c516d2faee4174d0e4a26b7a3d466"
}
],
"url": "https://www.tiktok.com/#sakura._.haruno_editz/video/6777103057055517958?region=KR&langCountry=pa&source=h5_t&lang=ar"
},
{
"pageTitle": "edit #anime #naruto #foryou #foryoupage #narutouzumaki ... - TikTok",
"partialMatchingImages": [
{
"url": "https://p16.muscdn.com/obj/tos-maliva-p-0068/b27c516d2faee4174d0e4a26b7a3d466"
}
],
"url": "https://www.tiktok.com/#sakura._.haruno_editz/video/6777103057055517958?region=KR&langCountry=pa&source=h5_t&lang=en"
},
{
"pageTitle": "edit #anime #naruto #foryou #foryoupage #narutouzumaki ... - TikTok",
"partialMatchingImages": [
{
"url": "https://p16.muscdn.com/obj/tos-maliva-p-0068/b27c516d2faee4174d0e4a26b7a3d466"
}
],
"url": "https://www.tiktok.com/#sakura._.haruno_editz/video/6777103057055517958?region=JP&langCountry=ja"
},
{
"pageTitle": "edit #anime #naruto #foryou #foryoupage #narutouzumaki ... - TikTok",
"partialMatchingImages": [
{
"url": "https://p16.muscdn.com/obj/tos-maliva-p-0068/b27c516d2faee4174d0e4a26b7a3d466"
}
],
"url": "https://www.tiktok.com/#sakura._.haruno_editz/video/6777103057055517958?lang=de"
}
],
"partialMatchingImages": [
{
"url": "https://p16.muscdn.com/obj/tos-maliva-p-0068/b27c516d2faee4174d0e4a26b7a3d466"
},
{
"url": "https://scontent-frt3-1.cdninstagram.com/vp/cdb9be9aa9707b90d55564a965668b7c/5E881986/t51.2885-19/s150x150/71524634_2513191889001976_2699215275693178880_n.jpg?_nc_ht=scontent-frt3-1.cdninstagram.com"
}
],
"visuallySimilarImages": [
{
"url": "https://previews.123rf.com/images/lenm/lenm1703/lenm170300080/73206609-sketchy-illustration-featuring-a-woman-looking-fondly-at-her-baby-strapped-to-a-carrier.jpg"
},
{
"url": "https://media.gettyimages.com/vectors/cartoon-soccer-football-girl-character-vector-id487299807"
},
{
"url": "https://pbs.twimg.com/profile_images/1062176350797066241/UhaIkhRy_400x400.jpg"
},
{
"url": "https://img.favpng.com/1/13/23/vertebrate-line-art-cartoon-clip-art-png-favpng-2LN24w4JHvqm4VfaF0gq56thE_t.jpg"
},
{
"url": "https://f1.pngfuel.com/png/337/556/27/smile-human-cartoon-character-pink-m-happiness-behavior-purple-png-clip-art-thumbnail.png"
},
{
"url": "https://img.favpng.com/8/3/13/clip-art-illustration-dance-hula-vector-graphics-png-favpng-jPQ56XsgP7Gi2cMLzhxbFApeA_t.jpg"
},
{
"url": "https://img.favpng.com/16/4/23/clip-art-pre-school-illustration-human-behavior-png-favpng-VEBwHZmyxNijn756GP0YUW6BV_t.jpg"
},
{
"url": "https://cdn.imgbin.com/11/5/20/imgbin-blond-girl-woman-blonde-haired-s-vPKgK1yAr3Z1vhLcyBms7tCL0.jpg"
},
{
"url": "https://thumbnail.imgbin.com/3/13/22/imgbin-homo-sapiens-woman-cartoon-gipsy-nCHD5ktXjAryu06DKrqc4cZmR_t.jpg"
},
{
"url": "http://clipartmag.com/images/shocked-clipart-1.jpg"
},
{
"url": "https://i.pinimg.com/236x/10/89/7a/10897abb60aeafad127c8e80c5732001--doodle-kids-muslim-fashion.jpg"
},
{
"url": "https://art.pixilart.com/thumb/0721b071d8ec62a.png"
},
{
"url": "https://img.favpng.com/0/4/24/detective-cartoon-png-favpng-7t1LwLmVSieejTCmm39qDLgQV_t.jpg"
}
],
"webEntities": [
{
"description": "Hinata Hyuga",
"entityId": "/m/04b5nh",
"score": 0.32295
},
{
"description": "Naruto Uzumaki",
"entityId": "/m/02sp46",
"score": 0.31364998
},
{
"description": "Sakura Haruno",
"entityId": "/m/037b28",
"score": 0.30705
},
{
"description": "Naruto",
"entityId": "/m/01hryy",
"score": 0.2758
},
{
"description": "Illustration",
"entityId": "/m/01kr8f",
"score": 0.2729761
},
{
"description": "Cartoon",
"entityId": "/m/0215n",
"score": 0.25171754
},
{
"description": "TikTok",
"entityId": "/g/11f555cn8l",
"score": 0.2241
},
{
"description": "Anime",
"entityId": "/m/0jxy",
"score": 0.207
},
{
"description": "Text",
"entityId": "/m/07s6nbt",
"score": 0.19760928
},
{
"description": "Music video",
"entityId": "/m/0mdxd",
"score": 0.187
},
{
"description": "Dragon Ball",
"entityId": "/m/0k2dm",
"score": 0.1776
},
{
"description": "Character",
"entityId": "/m/0k5v2",
"score": 0.1657
},
{
"description": "Fiction",
"entityId": "/m/02xlf",
"score": 0.1247
}
]
}
}
The image above lists the terms under webDetection -> webEntities.
However, there's no one size fits all. Those terms are irrelevant in mickey's skin), whose tags, albeit loose, should be the ones under localizedObjectAnnotations or labelAnnotations. It would need human moderation to provide real value.
Of course, if you have no tags whatsoever, adding some groups from the response without human moderation would be better than nothing.
Other services from big players you can look at:
Watson Image Recognition (IBM)
Amazon Rekognition

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.

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

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);

Resources