{ "name": "Bookmark New YouTube Playlist Videos", "nodes": [ { "name": "On clicking 'execute'", "type": "n8n-nodes-base.manualTrigger", "position": [ -610, 160 ], "parameters": {}, "typeVersion": 1, "id": "bookmark-new-youtube-playlist-videos-0" }, { "name": "Every 30 mins", "type": "n8n-nodes-base.cron", "position": [ -610, 320 ], "parameters": { "triggerTimes": { "item": [ { "mode": "everyX", "unit": "minutes", "value": 30 } ] } }, "typeVersion": 1, "id": "bookmark-new-youtube-playlist-videos-1" }, { "name": "YouTube", "type": "n8n-nodes-base.youTube", "position": [ -440, 240 ], "parameters": { "resource": "playlistItem", "operation": "getAll", "playlistId": "YOUR_YOUTUBE_PLAYLIST_ID", "part": [ "snippet" ], "returnAll": false, "limit": 25, "options": {} }, "typeVersion": 1, "id": "bookmark-new-youtube-playlist-videos-2" }, { "name": "Select and remember new videos", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForAllItems", "jsCode": "const items=$input.all();if(!items.length)return [];const rows=items.map(i=>{const s=i.json.snippet,id=s?.resourceId?.videoId;if(typeof id!=='string'||!/^[A-Za-z0-9_-]+$/.test(id)||typeof s?.title!=='string'||!s.title||typeof s?.videoOwnerChannelTitle!=='string'||!s.videoOwnerChannelTitle)throw Error('Each playlist item requires a video ID, title and owner');const title=s.videoOwnerChannelTitle+' | '+s.title;if(title.length>1000)throw Error('Bookmark title exceeds 1000 characters');return {id,link:'https://www.youtube.com/watch?v='+encodeURIComponent(id),title}});const staticData=$getWorkflowStaticData('global'),old=staticData.oldIds;if(old!==undefined&&(!Array.isArray(old)||old.some(x=>typeof x!=='string')))throw Error('Invalid saved video IDs');const fresh=old===undefined?rows:rows.filter(x=>!old.includes(x.id));staticData.oldIds=old===undefined?rows.map(x=>x.id):[...fresh.map(x=>x.id),...old];return fresh.map((json,index)=>({json,pairedItem:{item:index}}));" }, "id": "bookmark-new-youtube-playlist-videos-3" }, { "name": "Raindrop Bookmark", "type": "n8n-nodes-base.raindrop", "position": [ 40, 240 ], "parameters": { "resource": "bookmark", "operation": "create", "link": "={{ $json.link }}", "collectionId": -1, "additionalFields": { "tags": "youtube", "title": "={{ $json.title }}" } }, "typeVersion": 1, "id": "bookmark-new-youtube-playlist-videos-4" } ], "active": false, "settings": { "executionOrder": "v1", "timezone": "UTC" }, "connections": { "YouTube": { "main": [ [ { "node": "Select and remember new videos", "type": "main", "index": 0 } ] ] }, "Select and remember new videos": { "main": [ [ { "node": "Raindrop Bookmark", "type": "main", "index": 0 } ] ] }, "On clicking 'execute'": { "main": [ [ { "node": "YouTube", "type": "main", "index": 0 } ] ] }, "Every 30 mins": { "main": [ [ { "node": "YouTube", "type": "main", "index": 0 } ] ] } }, "pinData": {} }