1 00:00:04,840 --> 00:00:06,640 Item by plane. 2 00:00:07,150 --> 00:00:07,760 Hello, guys. 3 00:00:07,860 --> 00:00:15,040 Today, we're going to talk about pipelines and the easiest way to explain why this pipeline is if you 4 00:00:15,040 --> 00:00:23,620 imagine that after an item has been scrapped by the spider, it is immediately sent to the pipeline, 5 00:00:24,250 --> 00:00:28,600 which produces a fight with several components. 6 00:00:29,230 --> 00:00:37,220 So each pipeline component is actually a patent class that implements a simple metals. 7 00:00:37,510 --> 00:00:43,330 So the pipelines basically receive an item and perform an action over it. 8 00:00:43,840 --> 00:00:52,420 And they won't have the function and the option to decide if the item either has to continue through 9 00:00:52,420 --> 00:00:55,090 the pipeline or actually be dropped away. 10 00:00:55,440 --> 00:01:02,320 OK, so they have some mechanism over them, but we're going to show this in that video for sure. 11 00:01:02,740 --> 00:01:12,020 So the pipelines are usually used to clean HTML data who also validate scrub data. 12 00:01:12,040 --> 00:01:17,380 So if you don't want to scrub data, they would usually validate if the data you have is the correct 13 00:01:17,380 --> 00:01:27,010 one, they would also check for duplicates or they can simply store an item scrap item in the database. 14 00:01:27,730 --> 00:01:31,810 So let me actually show you how we can write your own pipelines. 15 00:01:32,350 --> 00:01:39,270 So, guys, if you have a look at the project that we created earlier and if you select here pipelines, 16 00:01:39,280 --> 00:01:44,620 you can see that the current pipeline is quite simple and it's represented by class. 17 00:01:44,920 --> 00:01:49,730 So obviously we can change that pipeline to the following. 18 00:01:49,780 --> 00:02:04,690 So let's try it from scrapie, dot exceptions, import drop item, OK, and then instead of diskless, 19 00:02:04,690 --> 00:02:06,190 we can create another one. 20 00:02:06,190 --> 00:02:17,650 So class and I would delete this item adapter from here so you can create a class called Price Pipeline. 21 00:02:18,460 --> 00:02:18,940 OK. 22 00:02:21,260 --> 00:02:24,640 And then hero, right object. 23 00:02:25,130 --> 00:02:29,480 OK, so here I will write about. 24 00:02:31,660 --> 00:02:35,060 Factor to be equal to one point one five. 25 00:02:35,920 --> 00:02:42,630 OK, then let's try the due process item. 26 00:02:43,060 --> 00:02:46,020 So this will be the function and let's right. 27 00:02:46,030 --> 00:02:57,780 Let's pass the function item and spider, OK, and then if item price. 28 00:02:58,180 --> 00:03:06,280 OK, so if the item to price and if item price. 29 00:03:08,370 --> 00:03:09,720 Excludes. 30 00:03:12,090 --> 00:03:12,810 What? 31 00:03:13,320 --> 00:03:13,820 OK. 32 00:03:15,800 --> 00:03:32,530 Item price equals item and then price multiplied by itself and thought, what factor? 33 00:03:32,920 --> 00:03:33,560 OK, so. 34 00:03:34,040 --> 00:03:41,630 So this basically means that if the price of the item is excluding the VAT, we'll need to multiply 35 00:03:41,630 --> 00:03:44,120 it by one point one five. 36 00:03:44,120 --> 00:03:45,410 Twatt, this tax. 37 00:03:45,480 --> 00:03:49,420 OK, this is the whole idea that the return item. 38 00:03:50,030 --> 00:03:52,730 OK, and let's right. 39 00:03:53,210 --> 00:04:00,520 Else raise and then drop item and here we are. 40 00:04:00,530 --> 00:04:01,030 Right. 41 00:04:02,330 --> 00:04:13,280 Missing price in percent as in on the place of the percentage who plays the actual item. 42 00:04:13,730 --> 00:04:15,620 OK, so obvious to hear. 43 00:04:15,620 --> 00:04:22,610 If we get different price from what we need, we're going to process it and display the actual price 44 00:04:22,610 --> 00:04:22,970 we need. 45 00:04:23,210 --> 00:04:29,630 So imagine if you're shopping and you want to extract information about item prices. 46 00:04:29,990 --> 00:04:38,240 And if you detect an item that is that is written with price excluding VAT, you always want to multiply 47 00:04:38,240 --> 00:04:39,950 it by one point one five. 48 00:04:40,190 --> 00:04:44,930 In order for you to be able to display the actual price of the item. 49 00:04:44,960 --> 00:04:51,470 So in the end, you have a good sheet with all the prices and you know that all of them are with the 50 00:04:51,470 --> 00:04:52,350 VAT factor. 51 00:04:53,150 --> 00:05:01,490 So this was all I want to share with you guys about the pipelines and what is the whole purpose of those 52 00:05:01,490 --> 00:05:02,170 pipelines. 53 00:05:02,510 --> 00:05:05,120 So that said, thank you very much for watching. 54 00:05:05,120 --> 00:05:13,340 I hope you use them very well, although they are not that commonly used when describing objects for 55 00:05:13,340 --> 00:05:17,600 some projects, you might need them, but is very good to know about their existence. 56 00:05:17,610 --> 00:05:20,760 So you are able to decide whether you need them or not. 57 00:05:21,200 --> 00:05:21,690 That's it. 58 00:05:21,710 --> 00:05:24,880 Thank you very much for watching and I'll see you in the next video.