Scrapy文檔 Scrapy
Scrapy,Python開發的一個快速、高層次的螢幕抓取和web抓取架構,用於抓取web網站並從頁面中提取結構化的資料。Scrapy用途廣泛,可以用於資料採礦、監測和自動化測試。
Scrapy迷人的地方在於它是一個架構,任何人都可以根據需求方便的修改。它也提供了多種類型爬蟲的基類,如BaseSpider、sitemap爬蟲等,最新版本又提供了web2.0爬蟲的支援。 安裝依賴
Scrapy安裝依賴於以下幾個Python庫
* lxml, an efficient XML and HTML parser
* parsel, an HTML/XML data extraction library written on top of lxml,
* w3lib, a multi-purpose helper for dealing with URLs and web page encodings
* twisted, an asynchronous networking framework
* cryptography and pyOpenSSL, to deal with various network-level security needs
我選擇手動安裝這些依賴
pip install lxmlpip install parselpip install w3libpip install twistedpip install cryptographypip install pyOpenSSL
其他的安裝都很順利,就是在安裝twisted的時候報錯了。
Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
於是下載離線的安裝(下載自己的版本)
https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
下載到一個目錄,然後用
pip install Twisted-17.9.0-cp36-cp36m-win32.whl
之後再用下面的命令安裝就可以了
pip install Scrapy