摘要: 今天回忆廖大的多线程的时候,看到下面有人写了个多线程的爬虫http://www.tendcode.com/article/jiandan-meizi-spider-2/,点进去看了下,分析的很仔细,写了接近200行代码吧 让后我就研究了一下这个网站,emmmm,selenium + PhantomJ 阅读全文
posted @ 2018-05-14 23:40 duck_lu 阅读(442373) 评论(0) 推荐(0) 编辑
摘要: 先贴上官方文档地址:https://selenium-python.readthedocs.io/installation.html Selenium真的是爬虫的神器,使用它以后,我们可以用浏览器做driver直接爬取网站,再也不怕javasript==动态网站了 1.安装 库安装很简单,文档上写的 阅读全文
posted @ 2018-05-13 16:15 duck_lu 阅读(576) 评论(0) 推荐(0) 编辑
摘要: http://jccxxt.scujcc.cn/ReaderLogin.aspx 这个网站爬了我接近三个星期,对,你没听错,先贴上我一直错的code 解释下我的心路历程: 先开始爬这个网站的时候,什么都不知道,以为提交一个用户名(name='TextBox1')就行了,后来发现自己太天真(ps:有很 阅读全文
posted @ 2018-05-13 15:36 duck_lu 阅读(892) 评论(0) 推荐(0) 编辑
摘要: 以爬取当当网作为实例 http://bj.ganji.com/fang1/chaoyang/ 通过xpath获取title和price 分别贴出spider, items, pipelines的code spider通过 rh = RenthouseItem() 这一句话初始化一个rh的实例,使我们 阅读全文
posted @ 2018-05-12 21:25 duck_lu 阅读(907) 评论(0) 推荐(0) 编辑
摘要: 这里我以GitHub登录这个网站为例 https://github.com/login 通过分析,我们可以得知这个网站上post必须带一个参数(用chrome或firefox都能看到表单提交了什么)authenticity_token 然后我们发现authenticity_token这个参数是一直在 阅读全文
posted @ 2018-05-11 21:52 duck_lu 阅读(1128) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MaxSize = 210; 9 10 vector a; 11 string suba; 12 int index;//find the smallest to be the pa... 阅读全文
posted @ 2018-05-08 19:36 duck_lu 阅读(457) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int INF = 1e6; 8 9 vector a; 10 string suba; 11 string rsuba; 12 13 int main(void) 14 { 15 int cas; 16... 阅读全文
posted @ 2018-05-08 19:30 duck_lu 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 在编码问题上困住了好久,对BeautifulSoup的问题在上一篇blog也分析了 最后写文件的时候用的gb18030编码解决的 UnicodeEncodeError: 'gbk' codec can't encode character '\xXX' in position XX 哎,我就是载在了 阅读全文
posted @ 2018-05-08 19:23 duck_lu 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 今天爬一个网站,它的class里有空格,导致我用BeautifulSoup半天没爬出来,后来看了文档,这叫多值属性: HTML 4定义了一系列可以包含多个值的属性.在HTML5中移除了一些,却增加更多.最常见的多值的属性是 class (一个tag可以有多个CSS的class). 还有一些属性 re 阅读全文
posted @ 2018-05-07 13:42 duck_lu 阅读(711) 评论(0) 推荐(0) 编辑
摘要: 使用说明:只要输入你想要的关键字即可(input已经提示了- -),然后在第29行那放你想要的文件目录就行了 notice:由于页面可以翻页,翻页是通过pn参数实现的,每次加20(每页有20张图),所以第一页pg为0,第二页为20,以此类推,改一下第19行的内容就可以翻到你想翻的页数了 问题:我的代 阅读全文
posted @ 2018-05-06 15:32 duck_lu 阅读(155) 评论(0) 推荐(0) 编辑