多线程爬虫:Python实现
所需包括:BeautifulSoup4、html5lib、Image、Requests、Redis、PyMySQL。安装所有依赖包:pip install Image requests beautifulsoup4 html5lib redis PyMySQL
。运行环境需支持中文,Python版本要求3.5。需安装MySQL和Redis,并配置config.ini文件设置MySQL和Redis,填写知乎帐号。可通过config.ini文件中的[sys] sleep_time控制爬虫速度,thread_num配置线程数目。向数据库导入init.sql。开始抓取数据:python get_user.py
。查看抓取数量:python check_redis.py
。
13.35KB
文件大小:
评论区