爬虫之python scrapy副本篇

2017-03-15  本文已影响0人  Bluemit

1. 环境配置

  1. [安利] vim
sudo apt-get install vim

为什么要用vim呢?因为打开vim你会看到

Help poor children in Uganda!

  1. scrapy
sudo apt-get install python-pip
sudo pip install scrapy

或者

sudo apt-get install python-scrapy
  1. BeautifulSoup
sudo pip install bs4

2. 背景知识

审查工具

F12

http

URL/URI
GET请求:
POST请求:
状态码:200 ok, 302重定向,403 forbidden,404 Not Found,500 Internal Service Error
Cookie
robots.txt
timestamp:1970.1.1到现在的秒数

html

xml
class
div
p strong
h1 h2 h3
不需要成对出现的:img br

json

json.cn

3. scrapy

迭代器

4. BeautifulSoup

soup.find()
find_all()
get_text()

5. 各种可能会遇到的问题

上一篇下一篇

猜你喜欢

热点阅读