Email notification on new YouTube uploads

[{"id":"aa52642e.36932","type":"inject","z":"190c8195.72b3be","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"UCT5C7yaO3RVuOgwP8JVAujQ","payloadType":"str","x":170,"y":1040,"wires":[["41c2f8e4.f2e028"]]},{"id":"41c2f8e4.f2e028","type":"http request","z":"190c8195.72b3be","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.youtube.com/feeds/videos.xml?channel_id=UCXIJgqnII2ZOINSWNOGFThA ","tls":"","persist":false,"proxy":"","authType":"","x":360,"y":1040,"wires":[["c3b93925.616aa"]]},{"id":"c3b93925.616aa","type":"xml","z":"190c8195.72b3be","name":"","property":"payload","attr":"","chr":"","x":500,"y":1120,"wires":[["810c61c9.ea902","e07fcc5c.4eea1"]]},{"id":"810c61c9.ea902","type":"debug","z":"190c8195.72b3be","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":1040,"wires":[]},{"id":"e07fcc5c.4eea1","type":"change","z":"190c8195.72b3be","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"$$.payload.feed.entry[0].author[0].name[0] & \" - \" & $$.payload.feed.entry[0].title[0]","tot":"jsonata"},{"t":"set","p":"temp[0]","pt":"msg","to":"payload.feed.entry[0].link[0].$.href","tot":"msg"},{"t":"set","p":"temp[1]","pt":"msg","to":"payload.feed.entry[0][\"media:group\"][0][\"media:thumbnail\"][0].$.url","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"$join($$.temp,\" \")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":1160,"wires":[["810c61c9.ea902"]]}]

and here is how to fetch with http request node (as i do not have rss feed parser install).
Then pass through xml node. And finally select the items required.

dceejay:
Wow, thank you so much! That's exactly how I want it. Oh my God, how many things you had to add. I had never been able to do that myself. :slight_smile:

But now it's easy for me to add more RSS sources. The only thing I don't get to work is the video thumbnail image in the email. This is not important of course, but would have been nice if it worked. I only receive an email with the clickable link. Can you explain that?

E1cid:
Thanks you too. However, I did not test your flow because the above works so well. But still thanks for an alternative option.

So how do you have it now ? the template should have just created a small html fragment with both the static image and the link text as the payload.
I get emails like

dceejay:
I managed to get the thumbnail image in the email to appear. I had to delete the / character in the image link, otherwise no image was displayed. I will mark your answer as a solution for so long, but I will test this for a few days and evaluate if it works as well as IFTTT. Thank you so much for the help I have got so far. I will return... :slight_smile:

1 Like

Hi again!
I have now been testing for 24 hours and it works fantastically well. However, I have noticed a slightly annoying thing. Some YouTube channels adjust the title of an uploaded video after a while, usually just a spelling correction, and Node-RED believe this change is a new video upload and a new email notification is sent for the same video with the same video URL.

I don't know how the RSS Feed applet in IFTTT works, but IFTTT does not behave like this. Right now while I am testing, I subscribe to the same RSS Feeds also with IFTTT to compare with. Only one email notification is sent per video even if the title is changed at a later time.

Is it possible to somehow fix this with a filter or condition in Node-RED?

Hi maybe like this

[{"id":"e8d66f121eae0a1e","type":"feedparse","z":"d5b4a507fb8086e8","name":"","url":"https://www.youtube.com/feeds/videos.xml?channel_id=UCXIJgqnII2ZOINSWNOGFThA ","interval":15,"x":450,"y":580,"wires":[["337c36976ffad73a"]]},{"id":"337c36976ffad73a","type":"change","z":"d5b4a507fb8086e8","name":"","rules":[{"t":"move","p":"topic","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"article.guid","tot":"msg"},{"t":"set","p":"title","pt":"msg","to":"article.author & \" - \" & 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":700,"wires":[["3e8889ab73637264"]]},{"id":"3e8889ab73637264","type":"rbe","z":"d5b4a507fb8086e8","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":520,"y":700,"wires":[["9f5f140f4872a7fc","17573bd04175f19d"]]},{"id":"9f5f140f4872a7fc","type":"template","z":"d5b4a507fb8086e8","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":820,"wires":[["5d2a9ad52c183f51"]]},{"id":"17573bd04175f19d","type":"debug","z":"d5b4a507fb8086e8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":700,"wires":[]},{"id":"590866c2cac23c2b","type":"e-mail","z":"d5b4a507fb8086e8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"youremail@gmail.com","dname":"","x":780,"y":820,"wires":[]},{"id":"5d2a9ad52c183f51","type":"change","z":"d5b4a507fb8086e8","name":"","rules":[{"t":"move","p":"title","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":820,"wires":[["590866c2cac23c2b"]]}]

In the first change I now use the article guid as the topic - hopefully that doesn't change when they update - and then in the second change node move the stored title back to the topic for the email.

1 Like

Thank you for taking the time to help me. I think I understand what you mean, but I had
never come up with a solution myself. I'm testing this for a while and will be back...

Hi again,
Now I have been testing for a while and everything works exactly as I wanted. Thank you all for the help, and especially you "dceejay". :+1:t2:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.