Email notification on new YouTube uploads

Hello everyone,

I have a question regarding a task that I want Node-RED to help me with. I'm a beginner and know basically nothing about this. Maybe it's very simple, I don't know.

I want to receive an email every time a new video is uploaded to a YouTube channel as I have specified. Actually several channels of course, but we can start with one. The email should be sent fairly immediately, perhaps after a maximum of 10-15 minutes after the new upload. I want the email subject to contain the channel name and the new video title. The email body does not have to contain anything other than a direct link to the new video. That's all!

Today I use IFTTT for this task and it works perfectly. But as everyone knows, this service costs so I am looking for a free alternative that can do exactly the same thing.

I have Node-RED installed on my Synology NAS with Docker and I suspect I should use the nodes Feedparser and Email. My first question is, is this task possible to do with Node-RED? Can any expert here help me and come up with tips on how this can be done most easily? :slight_smile:

f you are already getting email notification when a new video is running it should be easy. Just use the email node to receive the mail.

If you are asking if NR can monitor the YouTube channel sand send you an email, that is a different story. If you search the Flow tab using 'youtube' you will see a node that accesses the YouTube API BUT it hasn't been updated in 6 years so it is probably out of date.

You could try to contact the author and or fork the node and update it yourself. Other than that I would search and see how to access the YouTube API.

Thanks for your reply. No, YouTube does not have email notifications anymore. Google shut down that feature about a year ago. Today, this can only be done through the RSS feed that each channel has.

Like I said, today I use IFTTT for this task and it works perfectly. You don't need to be logged in to YouTube or even subscribe to the channel. The source is just a public RSS feed for each channel.

So see my question as more general for RSS feeds, not necessarily YouTube.

There are a couple RSS nodes you could try, just do a search in the Flows tab for 'rss'.

Please, read my entire first post. Of course, I have already tried myself first and knows the nodes Feedparser and Email. I know nothing about this so I am asking for an in depth guide that explains exactly how I should do to achieve my conditions I mention in my first post.

The email should be sent fairly immediately, perhaps after a maximum of 10-15 minutes after the new upload. I want the email subject to contain the channel name and the new video title. The email body does not have to contain anything other than a direct link to the new video.

Sorry if my suggestions haven't been of help and maybe someone else has done this or has some ideas but I would suggest you start trying something to see if you can figure it out.

In the time I've been on the forum this is the first time I seen a request like this and a forum search shows nothing, so you maybe the first to want to do it.

It isn't clear which bit you don't know how to do. Have you got the RSS feed working?

I have tried adding the nodes Feedparser and Email and connected them. I've added a test RSS feed in Feedparser with a refresh rate of 10 min, and added my email credentials to the Email node. Immediately I get several emails. I test with a YouTube channel that usually releases about 10 videos per day. The result is:

The subject line only contains the direct link to the video.
The email body only contains the text "null".

The biggest problem, however, is that I get regular emails for videos that are not new. I don't get this with IFTTT which I am also using right now to compare with. This could be, for example, for a video that is 5 steps back in the queue. And sometimes the same notification for the same video comes in the next refresh interval.

I suspect I need some kind of parameter to only get notification emails for new videos only. This is where my knowledge ends.

Here is an example of a YouTube channel feed if anyone wants to test this:

Always build flows up a bit at a time. Forget about the email for the moment. Concentrate on getting the feed working. Add a debug node to the output of the feed. Set it to show Complete Message. Have a look at what comes out and see if it contains the information you need.

It feels like we'll end this project right here. I did not feel that I had the knowledge to do something you ask me to do. I thought someone had already done something similar that could just share or sell a copy of their flow.

I use IFTTT today for this task and my question was just whether this could be solved easily with Node-RED instead. The only thing I need to enter in IFTTT are my RSS feed URLs, the refresh rate and my email credentials. Then everything just works. But I have no idea how advanced their RSS applet is basically.

I am beginning to understand that it is much more complicated with Node-RED and that you need significantly more knowledge than I have to achieve the same thing. But I still thank you for trying to help me. :+1:t2:

The other thing to consider is whether you want a learning exercise to learn about node-red in order to do more with it in the future. If you don't want to do anything like that (automating various parts of your home for example) then it probably isn't worth continuing with this. On the other hand if you plan to use node-red in the future then this could be a useful exercise.

Of course, if you or someone else here wants to help me all the way step by step how to do it, it is of course interesting and can be useful for other automation.

I managed to understand this debug thing, and I can see that every post (if they are called so) contains all the information that I want the email notification to contain.

To the email subject line:
"author" = channel name
"#" = video title

To the email body:
"link" = a direct link to the new video
"image" = a thumbnail media image

What is the next step I should do? :slight_smile:

If you haven't already done so then watch this playlist: Node-RED Essentials.

Also read the node red docs page Working with Messages. I haven't looked in detail at what the node is sending, but probably you can use a Change node to Move the data from the feed message into the payload to be sent to the email.

Thanks, I'll be looking at this this weekend. I will return...

I have now watched all the videos and read the documentation. I have tested the Change node a lot but I still have no clue how to pick two specific objects from the feed and send it to payload and two specific objects to topic. If no one can tell me exactly how to do it, most easily by sharing a screenshot, I have to give up. This is way too advanced for me. :frowning:

Post an example of your object after the RSS feed parser and what properties you are after.

And exactly what you want to see in the topic and payload for that data.

I don't know all the correct terms, but I will try to explain. :slight_smile:

Here is an example YouTube RSS Feed URL for FOX News:

Maybe it's easier that you (who want to help me) just test yourself with this URL and see with your own eyes what data the feed provides? From what I can see, Payload is empty and Topic is the link to the video. Instead I want to take the data from the following four values: "author", "title", "link" and "image"

Exactly like this:
topic = "author" - "title"
payload = "link"

I don't need any other data. I don't really understand how to use the Change node to do this.

Did you see in the Working with Messages document how to copy the path to a property by clicking on the little popup button in the debug window? If so then do that for the properties you want and paste them here.

Here is a simple get go that uses the node-red-node-feedparser node to do the fetching -

[{"id":"e8d66f121eae0a1e","type":"feedparse","z":"b2841f81.4dd1e","name":"","url":" ","interval":15,"x":450,"y":780,"wires":[["337c36976ffad73a"]]},{"id":"337c36976ffad73a","type":"change","z":"b2841f81.4dd1e","name":"","rules":[{"t":"move","p":"topic","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":" & \" - \" & article.title","tot":"jsonata"},{"t":"set","p":"image","pt":"msg","to":"article.image.url","tot":"msg"},{"t":"delete","p":"article","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":900,"wires":[["3e8889ab73637264"]]},{"id":"3e8889ab73637264","type":"rbe","z":"b2841f81.4dd1e","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":520,"y":900,"wires":[["9f5f140f4872a7fc","17573bd04175f19d"]]},{"id":"9f5f140f4872a7fc","type":"template","z":"b2841f81.4dd1e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img src=\"{{{image}}}\"/ alt=\"Missing Image\"> \n<a href=\"{{{payload}}}\">Click here to see video.</a>","output":"str","x":300,"y":1020,"wires":[["48fd491e40472a6e","590866c2cac23c2b"]]},{"id":"17573bd04175f19d","type":"debug","z":"b2841f81.4dd1e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":900,"wires":[]},{"id":"590866c2cac23c2b","type":"e-mail","z":"b2841f81.4dd1e","server":"","port":"465","secure":true,"tls":true,"name":"","dname":"","credentials":{"userid":"","password":""},"x":600,"y":1020,"wires":[]}]