1 00:00:0,160 --> 00:00:4,480 hi and welcome back let's explore the
2 00:00:2,750 --> 00:00:4,480
3 00:00:2,760 --> 00:00:6,879 case how Julia recently helped her
4 00:00:4,470 --> 00:00:6,879
5 00:00:4,480 --> 00:00:9,679 colleague Rajesh automate the process of
6 00:00:6,869 --> 00:00:9,679
7 00:00:6,879 --> 00:00:12,080 extracting data from a website using Ai
8 00:00:9,669 --> 00:00:12,080
9 00:00:9,679 --> 00:00:14,839 and saving it to the Google sheet just
10 00:00:12,070 --> 00:00:14,839
11 00:00:12,080 --> 00:00:17,039 like this but with AI she wanted to
12 00:00:14,829 --> 00:00:17,039
13 00:00:14,839 --> 00:00:19,000 share how they did it so others could
14 00:00:17,029 --> 00:00:19,000
15 00:00:17,039 --> 00:00:21,720 apply the same technique to their own
16 00:00:18,990 --> 00:00:21,720
17 00:00:19,000 --> 00:00:24,240 project so in this tutorial you will
18 00:00:21,710 --> 00:00:24,240
19 00:00:21,720 --> 00:00:26,760 learn how to use AI to extract data from
20 00:00:24,230 --> 00:00:26,760
21 00:00:24,240 --> 00:00:28,279 websites and the step-by-step process of
22 00:00:26,750 --> 00:00:28,279
23 00:00:26,760 --> 00:00:30,800 automating data
24 00:00:28,269 --> 00:00:30,800
25 00:00:28,279 --> 00:00:32,880 extraction lastly we will cover how to
26 00:00:30,790 --> 00:00:32,880
27 00:00:30,800 --> 00:00:36,640 Leverage The Power of AI to streamline
28 00:00:32,870 --> 00:00:36,640
29 00:00:32,880 --> 00:00:38,840 workflows with live web data so Julia
30 00:00:36,630 --> 00:00:38,840
31 00:00:36,640 --> 00:00:42,200 builds this automation for rajes and
32 00:00:38,830 --> 00:00:42,200
33 00:00:38,840 --> 00:00:44,360 make let's create the scenario together
34 00:00:42,190 --> 00:00:44,360
35 00:00:42,200 --> 00:00:47,120 we'll first log in to make.com and open
36 00:00:44,350 --> 00:00:47,120
37 00:00:44,360 --> 00:00:50,960 our scenario builder then we look for an
38 00:00:47,110 --> 00:00:50,960
39 00:00:47,120 --> 00:00:53,280 https module use the https module to
40 00:00:50,950 --> 00:00:53,280
41 00:00:50,960 --> 00:00:55,000 fetch the web content in other words to
42 00:00:53,270 --> 00:00:55,000
43 00:00:53,280 --> 00:00:57,840 bring the text on that web page into
44 00:00:54,990 --> 00:00:57,840
45 00:00:55,000 --> 00:00:59,760 your scenario for this you need to paste
46 00:00:57,830 --> 00:00:59,760
47 00:00:57,840 --> 00:01:1,079 the URL in the first field and then set
48 00:00:59,750 --> 00:01:1,079
49 00:00:59,760 --> 00:01:4,080 the method to
50 00:01:1,069 --> 00:01:4,080
51 00:01:1,079 --> 00:01:6,560 get it will now return the plain HTML
52 00:01:4,070 --> 00:01:6,560
53 00:01:4,080 --> 00:01:9,560 content of the website as you can see
54 00:01:6,550 --> 00:01:9,560
55 00:01:6,560 --> 00:01:11,920 here now let's convert the HTML to plain
56 00:01:9,550 --> 00:01:11,920
57 00:01:9,560 --> 00:01:14,200 text using the tools module in this
58 00:01:11,910 --> 00:01:14,200
59 00:01:11,920 --> 00:01:16,119 module all you have to do is map the
60 00:01:14,190 --> 00:01:16,119
61 00:01:14,200 --> 00:01:17,200 HTML text you received from your
62 00:01:16,109 --> 00:01:17,200
63 00:01:16,119 --> 00:01:19,680 previous
64 00:01:17,190 --> 00:01:19,680
65 00:01:17,200 --> 00:01:22,799 module then to extract the contents into
66 00:01:19,670 --> 00:01:22,799
67 00:01:19,680 --> 00:01:26,439 a usable form you can pass it to
68 00:01:22,789 --> 00:01:26,439
69 00:01:22,799 --> 00:01:29,159 anthropic select app of
70 00:01:26,429 --> 00:01:29,159
71 00:01:26,439 --> 00:01:32,040 anthropic we first Define the model in
72 00:01:29,149 --> 00:01:32,040
73 00:01:29,159 --> 00:01:34,520 my case clae 3.5 Sonet and the max
74 00:01:32,030 --> 00:01:34,520
75 00:01:32,040 --> 00:01:37,119 number of tokens which Define how long
76 00:01:34,510 --> 00:01:37,119
77 00:01:34,520 --> 00:01:39,240 the expected output should be in our
78 00:01:37,109 --> 00:01:39,240
79 00:01:37,119 --> 00:01:41,079 case we could get a long output from our
80 00:01:39,230 --> 00:01:41,079
81 00:01:39,240 --> 00:01:43,560 website so it's better to choose a
82 00:01:41,069 --> 00:01:43,560
83 00:01:41,079 --> 00:01:46,040 higher number of tokens like
84 00:01:43,550 --> 00:01:46,040
85 00:01:43,560 --> 00:01:47,799 4,000 here we now add the prompt with
86 00:01:46,030 --> 00:01:47,799
87 00:01:46,040 --> 00:01:50,680 instructions to extract the titles and
88 00:01:47,789 --> 00:01:50,680
89 00:01:47,799 --> 00:01:52,360 excerpts into a Json format we will show
90 00:01:50,670 --> 00:01:52,360
91 00:01:50,680 --> 00:01:54,479 the details of our prompt a little later
92 00:01:52,350 --> 00:01:54,479
93 00:01:52,360 --> 00:01:57,240 in this video so don't worry about it
94 00:01:54,469 --> 00:01:57,240
95 00:01:54,479 --> 00:02:0,000 now now we need to parse the Json output
96 00:01:57,230 --> 00:02:0,000
97 00:01:57,240 --> 00:02:1,159 from the AI using the Json module so
98 00:01:59,990 --> 00:02:1,159
99 00:02:0,000 --> 00:02:3,399 will just map the response from
100 00:02:1,149 --> 00:02:3,399
101 00:02:1,159 --> 00:02:5,119 anthropic into this field no need to
102 00:02:3,389 --> 00:02:5,119
103 00:02:3,399 --> 00:02:7,680 worry about creating the data structure
104 00:02:5,109 --> 00:02:7,680
105 00:02:5,119 --> 00:02:10,680 now and add the extracted data as row in
106 00:02:7,670 --> 00:02:10,680
107 00:02:7,680 --> 00:02:13,319 a Google sheet using the Google Sheets
108 00:02:10,670 --> 00:02:13,319
109 00:02:10,680 --> 00:02:16,280 module now let's set up the Google
110 00:02:13,309 --> 00:02:16,280
111 00:02:13,319 --> 00:02:18,879 sheet we copy the ID here from the URL
112 00:02:16,270 --> 00:02:18,879
113 00:02:16,280 --> 00:02:21,400 bar we paste it in the spreadsheet ID
114 00:02:18,869 --> 00:02:21,400
115 00:02:18,879 --> 00:02:23,599 field now we select the Sheet's name
116 00:02:21,390 --> 00:02:23,599
117 00:02:21,400 --> 00:02:27,120 which is in that case legal news and set
118 00:02:23,589 --> 00:02:27,120
119 00:02:23,599 --> 00:02:29,920 the column range A to Z is enough
120 00:02:27,110 --> 00:02:29,920
121 00:02:27,120 --> 00:02:31,800 here after this we take the Json
122 00:02:29,910 --> 00:02:31,800
123 00:02:29,920 --> 00:02:33,680 module's output and map it into Google
124 00:02:31,790 --> 00:02:33,680
125 00:02:31,800 --> 00:02:35,599 sheet once we finish setting up the
126 00:02:33,670 --> 00:02:35,599
127 00:02:33,680 --> 00:02:38,319 Google Sheets let's go through the
128 00:02:35,589 --> 00:02:38,319
129 00:02:35,599 --> 00:02:40,280 process step by step again first the
130 00:02:38,309 --> 00:02:40,280
131 00:02:38,319 --> 00:02:43,920 HTTP module retrieves the webpage
132 00:02:40,270 --> 00:02:43,920
133 00:02:40,280 --> 00:02:45,680 content check their HTML here next the
134 00:02:43,910 --> 00:02:45,680
135 00:02:43,920 --> 00:02:47,680 tools module converts the HTML to
136 00:02:45,670 --> 00:02:47,680
137 00:02:45,680 --> 00:02:49,560 markdown text making it simpler to
138 00:02:47,670 --> 00:02:49,560
139 00:02:47,680 --> 00:02:52,920 process and allows us to stay in the AI
140 00:02:49,550 --> 00:02:52,920
141 00:02:49,560 --> 00:02:54,959 token context window now for the Magic
142 00:02:52,910 --> 00:02:54,959
143 00:02:52,920 --> 00:02:57,720 in the anthropic module we provided
144 00:02:54,949 --> 00:02:57,720
145 00:02:54,959 --> 00:03:0,400 clear instructions with a prompt to the
146 00:02:57,710 --> 00:03:0,400
147 00:02:57,720 --> 00:03:2,120 AI our prompt says
148 00:03:0,390 --> 00:03:2,120
149 00:03:0,400 --> 00:03:3,519 extract the following information from
150 00:03:2,110 --> 00:03:3,519
151 00:03:2,120 --> 00:03:5,920 the provided
152 00:03:3,509 --> 00:03:5,920
153 00:03:3,519 --> 00:03:9,400 HTML find all the article headlines
154 00:03:5,910 --> 00:03:9,400
155 00:03:5,920 --> 00:03:10,879 within H2 tags that have a link for each
156 00:03:9,390 --> 00:03:10,879
157 00:03:9,400 --> 00:03:12,560 headline extract the text of the
158 00:03:10,869 --> 00:03:12,560
159 00:03:10,879 --> 00:03:15,159 headline as the title
160 00:03:12,550 --> 00:03:15,159
161 00:03:12,560 --> 00:03:17,159 field extract the text content of the
162 00:03:15,149 --> 00:03:17,159
163 00:03:15,159 --> 00:03:19,120 immediately following paragraph tag as
164 00:03:17,149 --> 00:03:19,120
165 00:03:17,159 --> 00:03:21,599 the excerpt
166 00:03:19,110 --> 00:03:21,599
167 00:03:19,120 --> 00:03:24,239 field this now returns a collection of
168 00:03:21,589 --> 00:03:24,239
169 00:03:21,599 --> 00:03:24,239 title and
170 00:03:24,869 --> 00:aN:NaN,NaN
171 00:03:24,879 --> 00:03:29,840 excerpt so we now need to compile the
172 00:03:27,309 --> 00:03:29,840
173 00:03:27,319 --> 00:03:32,480 extracted data into a Json object with
174 00:03:29,830 --> 00:03:32,480
175 00:03:29,840 --> 00:03:35,040 keys title and excerpt for each article
176 00:03:32,470 --> 00:03:35,040
177 00:03:32,480 --> 00:03:38,080 to actually work with it inside
178 00:03:35,030 --> 00:03:38,080
179 00:03:35,040 --> 00:03:40,920 make it is useful for the AI to always
180 00:03:38,070 --> 00:03:40,920
181 00:03:38,080 --> 00:03:43,480 provide few shot examples like seen here
182 00:03:40,910 --> 00:03:43,480
183 00:03:40,920 --> 00:03:45,959 an example of the desired Json output
184 00:03:43,470 --> 00:03:45,959
185 00:03:43,480 --> 00:03:48,640 format this approach we can strongly
186 00:03:45,949 --> 00:03:48,640
187 00:03:45,959 --> 00:03:48,640 recommend to
188 00:03:49,750 --> 00:aN:NaN,NaN
189 00:03:49,760 --> 00:03:54,200 Rajesh we should also add to the end
190 00:03:52,309 --> 00:03:54,200
191 00:03:52,319 --> 00:03:56,840 that the AI should not return anything
192 00:03:54,190 --> 00:03:56,840
193 00:03:54,200 --> 00:03:58,680 else than the Json so we avoid errors
194 00:03:56,830 --> 00:03:58,680
195 00:03:56,840 --> 00:04:0,519 where a plenty of other information is
196 00:03:58,670 --> 00:04:0,519
197 00:03:58,680 --> 00:04:2,840 returned
198 00:04:0,509 --> 00:04:2,840
199 00:04:0,519 --> 00:04:5,000 the AI does now the heavy lifting and
200 00:04:2,830 --> 00:04:5,000
201 00:04:2,840 --> 00:04:7,959 the Json module parses the structured
202 00:04:4,990 --> 00:04:7,959
203 00:04:5,000 --> 00:04:10,400 data as we wanted it let's save the data
204 00:04:7,949 --> 00:04:10,400
205 00:04:7,959 --> 00:04:12,840 in the Google Sheets module there it
206 00:04:10,390 --> 00:04:12,840
207 00:04:10,400 --> 00:04:15,480 adds each title and excerpt as a new row
208 00:04:12,830 --> 00:04:15,480
209 00:04:12,840 --> 00:04:18,799 in rajesh's spreadsheet great we are
210 00:04:15,470 --> 00:04:18,799
211 00:04:15,480 --> 00:04:18,799 finally ready to run the whole
212 00:04:19,670 --> 00:aN:NaN,NaN
213 00:04:19,680 --> 00:04:25,040 scenario we can see that it worked the
214 00:04:22,749 --> 00:04:25,040
215 00:04:22,759 --> 00:04:26,880 latest blog post titles and excerpts
216 00:04:25,030 --> 00:04:26,880
217 00:04:25,040 --> 00:04:28,080 automatically extracted and added to
218 00:04:26,870 --> 00:04:28,080
219 00:04:26,880 --> 00:04:30,360 rajesh's
220 00:04:28,070 --> 00:04:30,360
221 00:04:28,080 --> 00:04:32,960 spreadsheet so to sum up what we did in
222 00:04:30,350 --> 00:04:32,960
223 00:04:30,360 --> 00:04:35,919 this use Case by leveraging the power of
224 00:04:32,950 --> 00:04:35,919
225 00:04:32,960 --> 00:04:37,680 AI Julia and rajes turned unstructured
226 00:04:35,909 --> 00:04:37,680
227 00:04:35,919 --> 00:04:39,840 web data into structured data that
228 00:04:37,670 --> 00:04:39,840
229 00:04:37,680 --> 00:04:42,280 Rajesh could use in his
230 00:04:39,830 --> 00:04:42,280
231 00:04:39,840 --> 00:04:44,120 automations this is just one example of
232 00:04:42,270 --> 00:04:44,120
233 00:04:42,280 --> 00:04:46,280 how one can use AI to streamline
234 00:04:44,110 --> 00:04:46,280
235 00:04:44,120 --> 00:04:48,639 workflows and stay on top of important
236 00:04:46,270 --> 00:04:48,639
237 00:04:46,280 --> 00:04:50,600 information congratulations on mastering
238 00:04:48,629 --> 00:04:50,600
239 00:04:48,639 --> 00:04:52,320 this use case and we look forward to
240 00:04:50,590 --> 00:04:52,320
241 00:04:50,600 --> 00:04:55,199 guiding you through the AI World in our
242 00:04:52,310 --> 00:04:55,199
243 00:04:52,320 --> 00:04:55,199 other videos