![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
voyagerlll
...
展开
-
豆瓣电影排行榜爬取
#请求页已经能够得到数据,但是自己整理下感觉会更好些import requests, jsondef main(page): url = 'https://movie.douban.com/j/chart/top_list?type=11&interval_id=100%3A90&action=&start=' + str(page) + '&limit=...原创 2018-07-19 22:50:07 · 898 阅读 · 0 评论 -
爬取猫眼电影排行榜
参考自:《python3 网络爬虫开发实战》 用正则查找import requests, re, jsondef main(offset): #通过观察url看出只有offset后面的值在变 url = 'http://maoyan.com/board/4?offset=' + str(offset) headers = { 'User-Agent': 'Mo...原创 2018-07-19 21:01:32 · 448 阅读 · 0 评论 -
爬取花瓣网并批量下载图片
f12查看网页源码,当下拉的时候会出现ajax请求点击上图中的url,在headers最后一栏,比对后发现网页的url基本相同除了page会变以下是源码import requests, osfrom urllib.parse import urlencodefrom bs4 import BeautifulSoup as bs from selenium imp...原创 2018-07-27 21:34:10 · 5542 阅读 · 1 评论 -
(Scrapy)AttributeError: 'str' object has no attribute 'iter'
参考链接:https://stackoverflow.com/questions/29081330/scrapy-str-object-has-no-attribute-iter 在StackOverflow上找到的 restrict_xpaths应该指向元素 - 要么直接是链接要么包含链接而不是属性...翻译 2018-08-28 09:04:01 · 3090 阅读 · 0 评论 -
Redis 常用操作
参考自:python3网络爬虫开发实战 # 连接方式 一 import redis redis = redis.StrictRedis(host='localhost', port=6379, db=0, password=None)# 连接方式 二from redis import StrictRedis, ConnectionPool pool = ConnectionPoo...原创 2019-01-07 22:15:28 · 282 阅读 · 0 评论 -
代理池(python爬虫)
参考资料:python3网络爬虫开发实战代理池共分为四个模块:‘获取模块’,‘存储模块’,’检测模块‘,(’api‘模块)获取模块:主要通过元类实现,各大代理的抓取 存储模块:通过redis有序集合并通过检测模块检测代理是否可用 检测模块:通过asyncio和aiohttp实现异步并发请求,从而达到快读检测代理的有效性 api模块:(个人感觉有点鸡肋了)用flask构建一个本地a...原创 2019-01-07 22:56:20 · 655 阅读 · 0 评论