AppleTV Integration Deep Link URLs - Which Are Working?

First a node to builde the search. Service gets the service provider from an input select. Serie from an input text. You can add more cases if needed


const apiKey = "YOUR_API"; 
const baseUrl = "https://serpapi.com/search.json";
const service = msg.service.toLowerCase();
const serie = msg.serie;

if (!serie) return null;

let søkeord;

switch (leverandor.replace(/_/g, " ")) {
    case "apple tv":
    case "prime":
        søkeord = `"${serie}" site:tv.apple.com`;
        break;
    case "netflix":
        søkeord = `"${serie}" site:netflix.com`;
        break;
    default:
        søkeord = `${serie}`;
}

msg.search_url = `${baseUrl}?q=${encodeURIComponent(søkeord)}&api_key=${apiKey}&engine=google`; 
return msg;

Then I have an http get with the url set to: {{{search_url}}}

After the http-get another function node:


let res;

try {
    res = typeof msg.payload === "string" ? JSON.parse(msg.payload) : msg.payload;
} catch (e) {
    node.warn("Failed to parse JSON from SerpAPI response");
    return null;
}

const results = res?.organic_results || [];
const provider = msg.service?.toLowerCase() || "";

let desiredDomain = "";

if (provider.includes("netflix")) {
    desiredDomain = "netflix.com";
} else if (provider.includes("apple") || provider.includes("prime")) {
    desiredDomain = "tv.apple.com";
} else if (provider.includes("nrk")) {
    desiredDomain = "tv.nrk.no";
}

// Try to find the first link that matches the desired domain
let link = "";
for (const result of results) {
    if (result.link && result.link.includes(desiredDomain)) {
        link = result.link;
        break;
    }
}

msg.serie_link = (link || "").trim();
return msg;

1 Like

you’re s star - thanks!

Hi ! Do you find for twitch ? I tried twitch;// or http:// twitch.tv /stramname but nothing…

Netflix released a new update to the TVOS app earlier in the month, and it appears deep linking is no longer working for that app. I’ve tried about seven different combinations, and none of them work (including the ones that were working two weeks ago). So thanks to Netflix for making their app less useful I guess.

Does anyone know who to play a local video mp4 on a apple ? The video is hosted locally on home assistant server. I have tried the following with no success:

action: media_player.play_media
target:
  entity_id: media_player.salon
data:
  media_content_id: media-source://media_source/local/Wedvideo.mp4
  media_content_type: url

Thank you in advance!

Mine all of sudden stopped working today, just throwing non descriptive error messages. Are you having any problems with your plex?

wanted to add to this–

Youtube deep links work well for opening youtube + launching the desired video

youtube://www.youtube.com/watch?v=dQw4w9WgXcQ

I created an automation that runs a bunch of daemons and creates a playlist of youtube videos, then automatically plays them and follows me around the house as I’m detected in different rooms (all written in python, but use home assistant API to query sensor data)

I have yet to figure out how to do YoutubeTV deep links to specific channels, as I’m trying to automate opening YoutubeTV on the Apple TVs and navigating to the desired channels when wanting to watch football / basketball games. Right now I’ve got a real janky directional command list to play certain channels (e.g. cnbc - right down down down down down select), and wish I could figure out the deeplinks. I know it’s gotta be 1/2 way possible b/c my phone can airplay direct to a deep link YoutubeTV channel, but I’ve yet to be able to reverse the API to see if it’s even possible via pyatv / home assistant.

sorry - only just seen this - is it fixed or would you like me to check?