Getting youtube video id to cast to roku

Okay so, I’ve found you can cast a youtube video to a roku tv using:

switch:

But I want it to always play the newest video uploaded to the channel, for that you need the videoId (its the string after contentID=), for that you can use the youtube api:

https://www.googleapis.com/youtube/v3/search?key=“Your youtube api key here without quotes”&channelId=UCXuqSBlHAE6Xw-yeJA0Tunw&part=snippet,id&order=date&maxResults=1

I need to find a way to set the above to a variable so that I could turn the first curl command into somthing like this:

command_on: “curl -X POST http://10.0.0.171:8060/launch/837?contentID={{apiValueToVariable.items.id.videoid}}&MediaType=live”

I’ve tried doing it with a sensor but I get an error saying the api value is incorrect or over 255 chars, not exactly sure what I could try next, I noticed there is a custom variable custom component but im not sure how to set it to a web variable, I know you can somehow use value_json to get around the 255 char issue, but im not sure if any of this is working at all, it seems there’s probably a very simple way to do this that im missing.

Thanks in advance guys.

Check out Ludeeus youtube sensor