-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Expand file tree
/
Copy pathExtract insights & analyse YouTube comments via AI Agent chat.json
More file actions
1194 lines (1194 loc) · 27.4 KB
/
Copy pathExtract insights & analyse YouTube comments via AI Agent chat.json
File metadata and controls
1194 lines (1194 loc) · 27.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"meta": {
"instanceId": "6a2a7715680b8313f7cb4676321c5baa46680adfb913072f089f2766f42e43bd"
},
"nodes": [
{
"id": "f4b3833b-cf25-4bbc-927c-080586c5713c",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
700,
760
],
"parameters": {
"color": 7,
"width": 330.5152611046425,
"height": 239.5888196628349,
"content": "### ... or watch set up video [13 min]\n[](https://youtu.be/6RmLZS8Yl4E)\n"
},
"typeVersion": 1
},
{
"id": "64d96c53-b3e2-4aea-9a29-9b9e5c729f4f",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
240
],
"parameters": {
"color": 7,
"width": 636.2128494576581,
"height": 497.1532689930921,
"content": "\n## AI Agent To Chat With Youtube\n**Made by [Mark Shcherbakov](https://www.linkedin.com/in/marklowcoding/) from community [5minAI](https://www.skool.com/5minai)**\n\nNavigating the content generation and optimization process can be complex, especially without significant audience insight. This workflow automates insights extraction from YouTube videos and comments, empowering users to create more engaging and relevant content effectively.\n\nThe workflow integrates various APIs to gather insights from YouTube videos, enabling automated commentary analysis, video transcription, and thumbnail evaluation. The main functionalities include:\n- Extracting user preferences from comments.\n- Transcribing video content for enhanced understanding.\n- Analyzing thumbnails via AI for maximum viewer engagement insights.\n\n"
},
"typeVersion": 1
},
{
"id": "57d2ede9-1bf9-4449-9dc9-af1ccee763b6",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
760
],
"parameters": {
"color": 7,
"width": 280.2462120317618,
"height": 545.9087885077763,
"content": "### Set up steps\n\n1. **API Setup**:\n - Create a [Google Cloud](https://console.cloud.google.com/apis/dashboard) project and enable the YouTube Data API.\n - Generate an API key for [Apify](https://www.apify.com?fpr=ujogj).\n - Generate API key for [OpenAI](https://platform.openai.com)\n - Create all credentials in N8N - OpenAI, Apify, Google Cloud.\n\n2. **YouTube Creator and Video Selection**:\n - Start by defining a request to identify top creators based on their video views.\n - Capture the YouTube video IDs for further analysis of comments and other video metrics.\n\n3. **Comment Analysis**:\n - Gather comments associated with the selected videos and analyze them for user insights.\n - Implement pagination to handle the maximum comment retrieval limits in API requests.\n\n4. **Video Transcription**:\n - Request transcriptions for videos of interest, ensuring to manage potential costs associated with longer video processing.\n - Utilize the insights from transcriptions to formulate content plans.\n\n5. **Thumbnail Analysis**:\n - Evaluate your video thumbnails by submitting the URL through the OpenAI API to gain insights into their effectiveness.\n\n6. **Data Management**:\n - Incorporate a database agent to organize video data and metrics, allowing efficient record management and future content planning."
},
"typeVersion": 1
},
{
"id": "ca0fd549-88a7-44fd-ab81-7fd5ca140dae",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1540,
820
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "zJhr5piyEwVnWtaI",
"name": "OpenAi club"
}
},
"typeVersion": 1
},
{
"id": "7f2cf209-2e9d-4d6a-bc9e-d1bfd6df7266",
"name": "get_channel_details",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
1900,
820
],
"parameters": {
"name": "get_channel_details",
"fields": {
"values": [
{
"name": "command",
"stringValue": "=get_channel_details"
}
]
},
"schemaType": "manual",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "FgknOUpOBkpY85NX",
"cachedResultName": "Youtube parser - tools"
},
"description": "Get channel_id, title and description by handle/username.\nChannel_id is required to find videos and details about this channel.\nIf Youtube link to channel provided - parse handle from there or return channel_id. (e.g. https://www.youtube.com/@example_handle - example_handle)\n\n\nExample Input:\nexample_handle\n\nExample Output:\nid:UCOgz_YflAsYnGbdvzXuKNCA\ntitle:Daniel Simmons\ndescription:Digital Diary 🤎\\n\\n\\nWeekly videos around fashion...",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"handle\": {\n \"type\": \"string\",\n \"description\": \"Handle/username of channel\"\n }},\n \"required\": [\"handle\"]\n}",
"specifyInputSchema": true
},
"typeVersion": 1.2
},
{
"id": "c02f5c19-6e50-4a06-95b9-eceb3eec1012",
"name": "get_video_description",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
2020,
820
],
"parameters": {
"name": "get_video_description",
"fields": {
"values": [
{
"name": "command",
"stringValue": "video_details"
}
]
},
"schemaType": "manual",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "FgknOUpOBkpY85NX",
"cachedResultName": "Youtube parser - tools"
},
"description": "Fetch video details - the full description, title, and publish date of a video using its video_id.\n\nExample input:\nvideo_id:dQw4w9WgXcQ\n\nExample Output:\ntitle:Never Gonna Give You Up\ndescription: \"The official video for “Never Gonna Give You Up” by Rick Astley.\nduration:4 min\nviewCount:154\nlikeCount:6\nthumbnails: urls",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"video_id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the video to fetch details for\"\n }\n },\n \"required\": [\"video_id\"]\n}",
"specifyInputSchema": true
},
"typeVersion": 1.2
},
{
"id": "2d61160b-3a65-4766-ace6-947a7c5de6e5",
"name": "get_list_of_videos",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
2140,
820
],
"parameters": {
"name": "get_list_of_videos",
"fields": {
"values": [
{
"name": "command",
"stringValue": "videos"
}
]
},
"schemaType": "manual",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "FgknOUpOBkpY85NX",
"cachedResultName": "Youtube parser - tools"
},
"description": "Retrieve a list of videos from a channel using channel_id. Supports sorting by date, relevance, or view count.\n\nExample Input:\nchannel_id\": \"UCxxxxxxxxxxxxxxxx\"\nnumber_of_videos\": 5\norder: \"date\"\npublishedAfter: \"timestamp\"\n\nExample Output:\nvideo_id:abc123\ntitle:Latest Video\nshort cut description:Latest Video\npublished_at:2023-12-05T10:00:00Z",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"channel_id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the channel to fetch videos from\"\n },\n \"number_of_videos\": {\n \"type\": \"integer\",\n \"description\": \"The maximum number of videos to retrieve (max 50)\"\n },\n \"order\": {\n \"type\": \"string\",\n \"enum\": [\"date\", \"relevance\", \"viewCount\"],\n \"description\": \"Order in which to fetch videos\"\n },\n \"publishedAfter\": {\n \"type\": \"string\",\n \"description\": \"Timestamp for filtering like 2023-11-03T15:28:05Z.\"\n }\n },\n \"required\": [\"channel_id\", \"number_of_videos\", \"order\"]\n}",
"specifyInputSchema": true
},
"typeVersion": 1.2
},
{
"id": "c5aa2f7c-7748-4f88-abb6-fd274ad1295a",
"name": "get_list_of_comments",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
2260,
820
],
"parameters": {
"name": "get_list_of_comments",
"fields": {
"values": [
{
"name": "command",
"stringValue": "comments"
}
]
},
"schemaType": "manual",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "FgknOUpOBkpY85NX",
"cachedResultName": "Youtube parser - tools"
},
"description": "Retrieve a list of comments from a video using video_id.\n\nInput:\n \"video_id\": \"dQw4w9WgXcQ\"\n\nOutput:\n \"author\": \"John Doe\",\n \"comment\": \"This is an amazing video!\",\n \"published_at\": \"2023-12-04T12:00:00Z\"",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"video_id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the video to fetch comments from\"\n }\n },\n \"required\": [\"video_id\"]\n}",
"specifyInputSchema": true
},
"typeVersion": 1.2
},
{
"id": "c68cad77-1d71-45a3-b94b-8f7c701f56fb",
"name": "search",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
2380,
820
],
"parameters": {
"name": "search",
"fields": {
"values": [
{
"name": "command",
"stringValue": "search"
}
]
},
"schemaType": "manual",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "FgknOUpOBkpY85NX",
"cachedResultName": "Youtube parser - tools"
},
"description": "Search for videos or channels using a query. Supports filtering by type (video or channel) and sorting (date, viewCount, relevance). Use | for OR and - to exclude terms in the query.\n\nInput:\ntype: video or channel\nquery: search query\nsorting: date, viewCount, relevance\npublishedAfter: timestamp\n\nOutput:\n- id, title, short cut description, and published_at.",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\"video\", \"channel\"],\n \"description\": \"Type of results to retrieve: video or channel\"\n },\n \"query\": {\n \"type\": \"string\",\n \"description\": \"Search query. Supports | for OR and - to exclude terms\"\n },\n \"sorting\": {\n \"type\": \"string\",\n \"enum\": [\"date\", \"viewCount\", \"relevance\"],\n \"description\": \"Sorting criteria for search results\"\n },\n \"publishedAfter\": {\n \"type\": \"string\",\n \"description\": \"Timestamp for filtering like 2023-11-03T15:28:05Z\"\n }\n },\n \"required\": [\"type\", \"query\", \"sorting\"]\n}",
"specifyInputSchema": true
},
"typeVersion": 1.2
},
{
"id": "c87d5392-8a5c-4999-9e58-89a5e0700c40",
"name": "analyze_thumbnail",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
2500,
820
],
"parameters": {
"name": "analyze_thumbnail",
"fields": {
"values": [
{
"name": "command",
"stringValue": "analyze_thumbnail"
}
]
},
"schemaType": "manual",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "FgknOUpOBkpY85NX",
"cachedResultName": "Youtube parser - tools"
},
"description": "Analyze a thumbnail image based on a given prompt. The prompt can be customized for specific analysis needs, such as design critique, color scheme evaluation, or content assessment.\nUse link of maxRes thumbnail. \n\nInput:\n- url: URL of the thumbnail image.\n- prompt: Customizable instruction for the analysis.\n\nOutput:\n- Results of the analysis based on the given prompt.",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"url\": {\n \"type\": \"string\",\n \"description\": \"URL of the thumbnail image to analyze\"\n },\n \"prompt\": {\n \"type\": \"string\",\n \"description\": \"Customizable instruction to guide the image analysis\"\n }\n },\n \"required\": [\"url\", \"prompt\"]\n}",
"specifyInputSchema": true
},
"typeVersion": 1.2
},
{
"id": "1be2fa35-9091-4db8-a8eb-50f822d618d3",
"name": "video_transcription",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
2620,
820
],
"parameters": {
"name": "video_transcription",
"fields": {
"values": [
{
"name": "command",
"stringValue": "video_transcription"
}
]
},
"schemaType": "manual",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "FgknOUpOBkpY85NX",
"cachedResultName": "Youtube parser - tools"
},
"description": "Transcribe a video and retrieve its text transcription. Useful for analyzing video content or repurposing it for other formats.\n\nInput:\n- video_url: URL of the video to transcribe.\n\nOutput:\n- The text transcription of the video.",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"video_url\": {\n \"type\": \"string\",\n \"description\": \"URL of the video to transcribe\"\n }\n },\n \"required\": [\"video_url\"]\n}",
"specifyInputSchema": true
},
"typeVersion": 1.2
},
{
"id": "fbfcd82f-e247-4a21-be12-339df7afe681",
"name": "Postgres Chat Memory",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
1700,
820
],
"parameters": {
"sessionKey": "={{ $('When chat message received').item.json.sessionId }}",
"sessionIdType": "customKey"
},
"credentials": {
"postgres": {
"id": "AO9cER6p8uX7V07T",
"name": "Postgres 5minai"
}
},
"typeVersion": 1.3
},
{
"id": "6a4bbad9-27ab-448b-9222-2c8843fe241a",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1760,
560
],
"parameters": {
"text": "={{ $('When chat message received').item.json.chatInput }}",
"agent": "openAiFunctionsAgent",
"options": {
"systemMessage": "You are Youtube assistant. \nYou need to process user's requests and run relevant tools for that. \n\nPlan and execute in right order runs of tools to get data for user's request.\n\nIMPORTANT Search query and list of videos for channel tools returns all videos including shorts - use Get Video description tool to identify shorts (less than minute) and filter them out if needed.\n\nFeel free to ask questions before do actions - especially if you noticed some inconcistency in user requests that might be error/misspelling. "
},
"promptType": "define"
},
"typeVersion": 1.6
},
{
"id": "739cc12a-27d1-48e9-b124-7f83fb372514",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
1460,
600
],
"webhookId": "6e95bc27-99a6-417c-8bf7-2831d7f7a4be",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "613af9f2-77fa-42c4-86d3-87e20f2c0c89",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1380,
500
],
"parameters": {
"width": 1430.34590072234,
"height": 588.1344471094899,
"content": "## Scenario 1: AI agent"
},
"typeVersion": 1
},
{
"id": "54116346-bc73-4a6a-8bca-f2a6e6699374",
"name": "Get Comments",
"type": "n8n-nodes-base.httpRequest",
"position": [
2064,
1598
],
"parameters": {
"url": "=https://www.googleapis.com/youtube/v3/commentThreads",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "id,snippet,replies"
},
{
"name": "videoId",
"value": "={{ $('Execute Workflow Trigger').item.json.query.video_id }}"
},
{
"name": "maxResults",
"value": "100"
}
]
}
},
"credentials": {
"httpQueryAuth": {
"id": "1DXeuNaLSixqGPaU",
"name": "Query Auth account Youtube"
}
},
"typeVersion": 4.2
},
{
"id": "faabf71a-69f2-4113-802e-124a09fa9a0a",
"name": "Execute Workflow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
1444,
1598
],
"parameters": {},
"typeVersion": 1
},
{
"id": "4b3ec3aa-7c69-4a72-a989-02f97acdf612",
"name": "Get Channel Details",
"type": "n8n-nodes-base.httpRequest",
"position": [
2064,
1278
],
"parameters": {
"url": "=https://www.googleapis.com/youtube/v3/channels",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet"
},
{
"name": "forHandle",
"value": "={{ $('Execute Workflow Trigger').item.json.query.handle }}"
}
]
}
},
"credentials": {
"httpQueryAuth": {
"id": "1DXeuNaLSixqGPaU",
"name": "Query Auth account Youtube"
}
},
"typeVersion": 4.2
},
{
"id": "ed8dec73-8c50-4eb9-8efe-68ee72c4d5e6",
"name": "Get Video Description",
"type": "n8n-nodes-base.httpRequest",
"position": [
2064,
1438
],
"parameters": {
"url": "=https://www.googleapis.com/youtube/v3/videos",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet,contentDetails,statistics"
},
{
"name": "id",
"value": "={{ $('Execute Workflow Trigger').item.json.query.video_id }}"
}
]
}
},
"credentials": {
"httpQueryAuth": {
"id": "1DXeuNaLSixqGPaU",
"name": "Query Auth account Youtube"
}
},
"typeVersion": 4.2
},
{
"id": "c1ff3837-8d7e-49ad-a333-c177833fcd05",
"name": "Edit Fields",
"type": "n8n-nodes-base.set",
"position": [
2224,
1598
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "469d89ba-23fc-482a-b4ae-ce5d3bc13579",
"name": "response",
"type": "string",
"value": "={{ JSON.stringify(` Comments: ${$json.items.map(item => { const topLevelComment = `${item.snippet.topLevelComment.snippet.authorDisplayName}: ${item.snippet.topLevelComment.snippet.textOriginal}`; const replies = item.replies?.comments.map(reply => `${reply.snippet.authorDisplayName}: ${reply.snippet.textOriginal}` ).join('\\n') || ''; return [topLevelComment, replies].filter(Boolean).join('\\n'); }).join('\\n\\n')} `) }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "5f0c44fe-2523-4170-a27d-0ccd1bef24a7",
"name": "Run Query",
"type": "n8n-nodes-base.httpRequest",
"position": [
2064,
1758
],
"parameters": {
"url": "=https://www.googleapis.com/youtube/v3/search",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet"
},
{
"name": "q",
"value": "={{ $('Execute Workflow Trigger').item.json.query.query }}"
},
{
"name": "order",
"value": "={{ $('Execute Workflow Trigger').item.json.query.order }}"
},
{
"name": "type",
"value": "={{ $('Execute Workflow Trigger').item.json.query.type }}"
},
{
"name": "maxResults",
"value": "={{ $('Execute Workflow Trigger').item.json.query.number_of_videos }}"
},
{
"name": "publishedAfter",
"value": "={{ $('Execute Workflow Trigger').item.json.query.publishedAfter }}"
}
]
}
},
"credentials": {
"httpQueryAuth": {
"id": "1DXeuNaLSixqGPaU",
"name": "Query Auth account Youtube"
}
},
"typeVersion": 4.2
},
{
"id": "3e192718-6710-4143-ac6e-15df79ee5363",
"name": "Get Videos by Channel",
"type": "n8n-nodes-base.httpRequest",
"position": [
2064,
1918
],
"parameters": {
"url": "=https://www.googleapis.com/youtube/v3/search",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet"
},
{
"name": "channelId",
"value": "={{ $('Execute Workflow Trigger').item.json.query.channel_id }}"
},
{
"name": "order",
"value": "={{ $('Execute Workflow Trigger').item.json.query.order }}"
},
{
"name": "maxResults",
"value": "={{ $('Execute Workflow Trigger').item.json.query.number_of_videos }}"
},
{
"name": "type",
"value": "video"
},
{
"name": "publishedAfter",
"value": "={{ $('Execute Workflow Trigger').item.json.query.publishedAfter }}"
}
]
}
},
"credentials": {
"httpQueryAuth": {
"id": "1DXeuNaLSixqGPaU",
"name": "Query Auth account Youtube"
}
},
"typeVersion": 4.2
},
{
"id": "8bcb50a4-0cd1-4311-ac6a-2ee8653cfb71",
"name": "Response",
"type": "n8n-nodes-base.set",
"position": [
2564,
1598
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "cfdbe2f5-921e-496d-87bd-9c57fdc22a7a",
"name": "response",
"type": "object",
"value": "={{$json}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7f5a36d3-6710-4e69-8459-7c8c748ee7d9",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
1624,
1578
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "get_channel_details",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Execute Workflow Trigger').item.json.command }}",
"rightValue": "get_channel_details"
}
]
},
"renameOutput": true
},
{
"outputKey": "video_details",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "26a3ffe8-c8a6-4564-8d18-5494a8059372",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Execute Workflow Trigger').item.json.command }}",
"rightValue": "video_details"
}
]
},
"renameOutput": true
},
{
"outputKey": "comments",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0f51cc26-2e42-42e1-a5c2-cb1d2e384962",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Execute Workflow Trigger').item.json.command }}",
"rightValue": "comments"
}
]
},
"renameOutput": true
},
{
"outputKey": "search",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "51031140-5ceb-48aa-9f33-d314131a9653",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Execute Workflow Trigger').item.json.command }}",
"rightValue": "search"
}
]
},
"renameOutput": true
},
{
"outputKey": "videos",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f160bf0a-423f-448d-ab80-50a0b6a177ca",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Execute Workflow Trigger').item.json.command }}",
"rightValue": "videos"
}
]
},
"renameOutput": true
},
{
"outputKey": "analyze_thumbnail",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "29542ac4-7b9d-413f-aabb-a1cdabed2fa7",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Execute Workflow Trigger').item.json.command }}",
"rightValue": "analyze_thumbnail"
}
]
},
"renameOutput": true
},
{
"outputKey": "video_transcription",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "35fc39b8-6cf1-4ea6-9609-4a195c5526f8",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Execute Workflow Trigger').item.json.command }}",
"rightValue": "video_transcription"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "df432d53-33bf-4e91-9ead-7f4b36bd788a",
"name": "Get Video Transcription",
"type": "n8n-nodes-base.httpRequest",
"position": [
2064,
2238
],
"parameters": {
"url": "=https://api.apify.com/v2/acts/dB9f4B02ocpTICIEY/run-sync-get-dataset-items",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startUrls\": [\n \"{{ $('Execute Workflow Trigger').item.json.query.video_url }}\"\n ]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth"
},
"credentials": {
"httpQueryAuth": {
"id": "XDavOaI9qH5Zi3QC",
"name": "Apify"
}
},
"typeVersion": 4.2
},
{
"id": "8079e5c9-4a52-45ce-ac41-7fc707177a5a",
"name": "OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
2064,
2078
],
"parameters": {
"text": "={{ $('Execute Workflow Trigger').item.json.query.prompt }}",
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"resource": "image",
"imageUrls": "={{ $('Execute Workflow Trigger').item.json.query.url }}",
"operation": "analyze"
},
"credentials": {
"openAiApi": {
"id": "SphXAX7rlwRLkiox",
"name": "Test club key"
}
},
"typeVersion": 1.7
},
{
"id": "7847e82a-fe82-498c-8c14-4c1c718d632c",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1380,
1140
],
"parameters": {
"width": 1427.3810326521016,
"height": 1313.2689194736308,
"content": "## Scenario 2: Agent tools"
},
"typeVersion": 1
},
{
"id": "3a0fbbb0-4c0e-41f1-abb3-c87e955ad1b3",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1540,
960
],
"parameters": {
"color": 4,
"width": 266.7375650720483,
"height": 80,
"content": "### Replace credentials"
},
"typeVersion": 1
},
{
"id": "363eaca0-aaa5-4551-845f-528f19bba57a",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
2004,
1178
],
"parameters": {
"color": 4,
"width": 266.7375650720483,
"height": 80,
"content": "### Replace credentials in all nodes - Apify, OpenAI, Google"
},
"typeVersion": 1
}
],
"pinData": {
"Execute Workflow Trigger": [
{
"query": {
"type": "video",
"query": "Web scraping data with n8n and Puppeteer",
"sorting": "relevance"
},
"command": "search"
}
]
},
"connections": {
"OpenAI": {
"main": [
[
{
"node": "Response",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Get Channel Details",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Video Description",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Comments",
"type": "main",
"index": 0
}
],
[
{
"node": "Run Query",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Videos by Channel",
"type": "main",
"index": 0
}
],
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Video Transcription",
"type": "main",
"index": 0
}
]
]
},
"search": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",