In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Note: Most of the contents refer to http://www.cnblogs.com/voidsky/p/5490798.html, but the original text is not stored in the database.
First create a project douban9fen
kuku@ubuntu:~/pachong$ scrapy startproject douban9fenNew Scrapy project 'douban9fen', using template directory '/usr/local/lib/python2.7/dist-packages/scrapy/templates/project', created in: /home/kuku/pachong/douban9fenYou can start your first spider with: cd douban9fen scrapy genspider example example.comkuku@ubuntu:~/pachong$ cd douban9fen/
First, we need to determine the information we want to capture, including three fields: (1) title,(2) rating, and (3) author
Then, let's analyze the next, using Firefox browser, go to www.douban.com/doulist/1264675/
Press F12 to debug the above page
Follow steps 1, 2, and 3 to view the div to which each object belongs, and close the debug window.
Furthermore, right-click in the page to view the page source code, and in the page source code to view the place where the div tag in Search 3 is class bd doulist-subject
According to the principle of first big then small, we first use bd doulist-subject to find each book, and then extract the information in the loop.
Extract book frame:
'//div[@class="bd doulist-subject"]'
Extraction topic:
'div[@class="title"]/a/text()'
Extraction score:
'div[@class="rating"]/span[@class="rating_nums"]/text()'
Extract author: (Use regular convenient point here)
'(.*?) show databases;+--------------------+| Database |+--------------------+| information_schema || csvt04 || douban9fen || doubandianying || mysql || performance_schema || web08 |+--------------------+7 rows in set (0.00 sec)mysql> use douban9fen;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> show tables;+----------------------+| Tables_in_douban9fen |+----------------------+| douban9fen |+----------------------+1 row in set (0.00 sec)mysql> select * from douban9fen;
Shows that it can be successfully written to the database.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.