filmov
tv
Python Scrapy Tutorial - 12 - Item containers ( Storing scraped data )
![preview_player](https://i.ytimg.com/vi/QksUFT2Cmlo/maxresdefault.jpg)
Показать описание
In this video we are going to learning how to put that extracted data in containers called items.
Now why exactly do we need to put them in containers? Because we have already extracted the data. Can;t we just put them in some kind of database? The answer is yes. You can. But there might be a few problems when you are storing the data directly in the database when you are working on big/multiple projects.
Scrapy spiders can return the extracted data as Python dictionaries which we have already been doing right with our quotes project. But the problem with Python dictionaries is that it lacks structure. It is easy to make a typo in a field name or return inconsistent data, especially in a larger project with many spiders.
So it's always a good idea to move the scraped data to temporary location called containers and then store them inside the database. So these temporary containers are called as items.
Next video - Storing in JSON, XML and CSV
#python
Now why exactly do we need to put them in containers? Because we have already extracted the data. Can;t we just put them in some kind of database? The answer is yes. You can. But there might be a few problems when you are storing the data directly in the database when you are working on big/multiple projects.
Scrapy spiders can return the extracted data as Python dictionaries which we have already been doing right with our quotes project. But the problem with Python dictionaries is that it lacks structure. It is easy to make a typo in a field name or return inconsistent data, especially in a larger project with many spiders.
So it's always a good idea to move the scraped data to temporary location called containers and then store them inside the database. So these temporary containers are called as items.
Next video - Storing in JSON, XML and CSV
#python
Комментарии