How can I use Homey Pro Flow to play a news broadcast on a Google Nest Hub (2nd Gen)?

I’ve created a homey script (my first one - yeah :slight_smile: ):

// Create the request
const res = await fetch('https://www.tagesschau.de/multimedia/sendung/tagesschau_20_uhr/podcast-ts2000-video-100~podcast.xml');
if (!res.ok)
{
  throw new Error(res.statusText);
}

// Get the body text
const body = await res.text();

// Use a regex to find the MP4 URL
const regex = /<enclosure url="(https:\/\/.+?\.mp4)"/;
const match = body.match(regex);

if (match && match[1])
{
  await tag('tagesschau_url', `${match[1]}`);
}
else
{
  throw new Error('tagesschau_url mp4 no match');
}

Unfortunately, Homey Scripts NodeJS base doesn’t seem to have an XML parser, so I had to make it work with regex. But it works.

1 Like