随笔分类 - spider road
摘要:参考:http://blog.csdn.net/dawnranger/article/details/50037703 Selector 有一个 .re() 方法,用来通过正则表达式来提取数据。 不同于使用 .xpath() 或者 .css()方法, .re() 方法返回unicode字符串的列表,
阅读全文
摘要:参考:http://cuiqingcai.com/968.html http://cuiqingcai.com/977.html
阅读全文
摘要:参考博客:http://cuiqingcai.com/990.html 与用户交互
阅读全文
摘要:参考:http://www.jianshu.com/p/9d408e21dc3a http://www.cnblogs.com/luxiaojun/p/6144748.html 豆瓣应该是ip被封了。
阅读全文
摘要:# -*- coding:utf-8 -*- from selenium import webdriver from selenium.webdriver.common.keys import Keys import time print 1 # 创建一个无界面的对象 driver = webdriver.PhantomJS() driver.get("https://www.douba...
阅读全文
摘要:安装方式 $ pip install requests 基本GET请求(headers参数 和 parmas参数) 1.最基本的GET请求可以直接用get方法 response = requests.get("http://www.baidu.com/") # 也可以这么写 response = r
阅读全文
摘要:1.有些网页内容使用AJAX加载,AJAX一般返回的是JSON,直接对AJAX地址进行post或get,就返回JSON数据了。 2.用抓包工具分析https://movie.douban.com/j/chart/top_list?type=11&interval_id=100%3A90&action
阅读全文
摘要:1.发现在翻译时地址没有变,那是POST请求。 2.通过fidder抓包工具抓取url 3.对data分析,发现每次salt和sign都在变化。 4.查看源码,先用站长工具http://tool.chinaz.com/Tools/jsformat.aspx格式化,用sublines打开搜索到关键字s
阅读全文
摘要:1 # -*- coding:utf-8 -*- 2 import urllib, urllib2 3 import re 4 import sys 5 6 class Cuzz(): 7 """这是一个类""" 8 def __init__(self, url, header, start_page, end_page): 9 self.u...
阅读全文
摘要:urlopen 上面代码就是打开百度主页的“查看源代码”的内容,还是比较简单的。 Request 在上个例子里,urlopen()的参数就是一个url地址; 但是如果需要执行更复杂的操作,比如增加HTTP报头,必须创建一个 Request 实例来作为urlopen()的参数;而需要访问的url地址则
阅读全文

浙公网安备 33010602011771号