Skip to content

Instantly share code, notes, and snippets.

@bobchao
Created August 28, 2020 02:37
Show Gist options
  • Save bobchao/ff1a98b58b93292ef323e1756cd5fa51 to your computer and use it in GitHub Desktop.
Save bobchao/ff1a98b58b93292ef323e1756cd5fa51 to your computer and use it in GitHub Desktop.
Read csv which contains YouTube Video id & track id, then put sessions from a specific track into the playlist you choose.
{
"name": "Track Playlist",
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
130,
280
]
},
{
"parameters": {
"filePath": "[csv file path on you host]"
},
"name": "Read Binary File",
"type": "n8n-nodes-base.readBinaryFile",
"typeVersion": 1,
"position": [
280,
280
],
"notesInFlow": true,
"notes": "Read CSV"
},
{
"parameters": {
"options": {}
},
"name": "Spreadsheet File",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
430,
280
],
"notesInFlow": true,
"notes": "Parse CSV."
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$node[\"Spreadsheet File\"].json[\"trackid\"]}}",
"value2": "[track_id]"
}
]
}
},
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
610,
280
],
"notesInFlow": true,
"notes": "Pick sessions from a track"
},
{
"parameters": {
"resource": "playlistItem",
"playlistId": "[choose a playlist]",
"videoId": "={{$node[\"IF\"].json[\"video_id\"]}}",
"options": {}
},
"name": "YouTube",
"type": "n8n-nodes-base.youTube",
"typeVersion": 1,
"position": [
820,
170
],
"notesInFlow": true,
"credentials": {
"youTubeOAuth2Api": "[Google OAuth2]"
},
"notes": "Add session to a playlist"
},
{
"parameters": {},
"name": "NoOp",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
820,
390
],
"notesInFlow": true,
"notes": "Do nothing."
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Read Binary File",
"type": "main",
"index": 0
}
]
]
},
"Read Binary File": {
"main": [
[
{
"node": "Spreadsheet File",
"type": "main",
"index": 0
}
]
]
},
"Spreadsheet File": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "YouTube",
"type": "main",
"index": 0
}
],
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"timezone": "Asia/Taipei"
},
"id": "1"
}
@bobchao
Copy link
Author

bobchao commented Aug 28, 2020

Release under WTFPL 2.0 -- You just do what the f*** you want to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment