在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ZhihuSpider开源软件地址:https://gitee.com/JIANGWL/ZhihuSpider开源软件介绍:ZhihuSpiderUser spider for www.zhihu.com 1.Install python3 and packagesMake sure you have installed python3.Using pip to install dependencies. pip install Image requests beautifulsoup4 html5lib redis PyMySQL 2.Database ConfigInstall 3.Install redis# (ubuntu)apt-get install redis# or (centos)yum install redis# or (macos)brew install redis 4.Config your applicationComplete config.ini 5.Get startpython get_user.py# or command python3python3 get_user.py 中文在我的博客里有代码的详细解读:我用python爬了知乎一百万用户的数据 数据统计分析:百万知乎用户数据分析 这是一个多线程抓取知乎用户的程序Requirements需要用到的包: pip安装所有依赖包: pip install Image requests beautifulsoup4 html5lib redis PyMySQL 运行环境需要支持中文 测试运行环境python3.5,不保证其他运行环境能完美运行 1.需要安装mysql和redis 2.配置 可以通过配置 3.向数据库导入 Run开始抓取数据: 效果Docker嫌麻烦的可以参考一下我用docker简单的搭建一个基础环境:mysql和redis都是官方镜像 docker run --name mysql -itd mysql:latestdocker run --name redis -itd redis:latest 再利用docker-compose运行python镜像,我的python的docker-compose.yml: python: container_name: python build: . ports: - "84:80" external_links: - memcache:memcache - mysql:mysql - redis:redis volumes: - /docker_containers/python/www:/var/www/html tty: true stdin_open: true extra_hosts: - "python:192.168.102.140" environment: PYTHONIOENCODING: utf-8 我的Dockerfile: From kong36088/zhihu-spider:latest |
请发表评论