1. in acconda prompt, run shell

scrapy shell  some_url

2. test response

print(response.text)

3. css selector

response.css('li.active')

4. get html by css selector

response.css('li.active').extract()

5. get text, it returns a array

response.css('li.active::text').extract()

6. get single text, it returns a string

response.css('li.active::text')[0].extract()
//or
response.css('li.active::text').extract_first()

 

posted on 2017-06-05 10:05  jzfan  阅读(200)  评论(0编辑  收藏  举报