• 博文
  • 归档
  • Trending Apps: 从头开始分析流行应用 - 采集篇 - 环境设置 - 2

    2021-03-18

    次访问

    Link to previous chapter: 环境设置-1

    2. 开始第一个 Scarpy 项目

    2.1 创建项目

    因为我们本地并没有scrapy的executable,需要启动一个ad-hoc的容器并在容器里面操作, 进入容器:

    1
    > docker-compose run --rm scrapy

    现在开始创建我们的project

    1
    2
    3
    > cd /app
    > scrapy startproject app_trend
    > cd app_trend

    这样子会生成一个 app_trend folder, 其中主要的文件目录是:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    tutorial/
    scrapy.cfg # deploy configuration file
    tutorial/ # project's Python module, you'll import your code from here
    __init__.py
    items.py # project items definition file
    middlewares.py # project middlewares file
    pipelines.py # project pipelines file
    settings.py # project settings file
    spiders/ # !!! a directory where you'll later put your spiders
    __init__.py

    我们将会在 spiders/ folder 里面编写我们自己的 spider

    ...阅读全文
  • Trending Apps: 从头开始分析流行应用 - 采集篇 - 环境设置 - 1

    2021-03-17

    次访问

    项目目标

    收集最新的iOS App排名,并分析流行趋势

    采集篇

    使用到的tools

    1. scrapy: 基于python的网页采集框架
    2. scrapydweb: 用于 Scrapyd 集群管理的 web 应用,支持 Scrapy 日志分析和可视化。
    3. docker: 多服务容器管理

    1. 创建docker instance

    1.1 准备工作:

    1. 一台linux服务器
    2. 安装 docker 以及 docker-compose 工具

    1.2 文件目录

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    app_trend
    /code/ # 爬虫的python code放这儿
    /scrapy_web/ # scrapydweb 的 config,logs 以及 build file
    /app/
    # scrapydweb 的 config 文件
    # 用来override https://github.com/my8100/scrapydweb/blob/master/scrapydweb/default_settings.py
    /scrapydweb_settings_v10.py
    /logs/
    /data/
    /Dockerfile
    /scrapyd/
    /scrapyd.conf
    /Dockerfile
    /data/
    # 远程调用scrapyd的任务的output会在这
    /code/
    # 自定义启动scrapyd的脚本
    /entrypoint.sh
    ...阅读全文

分类归档

  • app_trend2

标签云

docker scrapy scrapyweb

最近文章

  • Trending Apps: 从头开始分析流行应用 - 采集篇 - 环境设置 - 2
  • Trending Apps: 从头开始分析流行应用 - 采集篇 - 环境设置 - 1

© 2016 - 2021 robot9, powered by Hexo
and hexo-theme-bubuzou

备案是什么 不存在的