码迷,mamicode.com
首页 > 编程语言 > 详细

Python爬虫(使用requests)

时间:2015-07-18 00:26:23      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:

import requests
from lxml import etree

url
= "http://avdb.la/actor/" headers = {"User-Agent":Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36} html = requests.get(url,headers = headers) content = html.text #content = content.encode("utf8") selector = etree.HTML(content) name = selector.xpath(//*[@id="waterfall"]/div/a/@title)

 

Python爬虫(使用requests)

标签:

原文地址:http://www.cnblogs.com/premier/p/4655920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!