Scrapy-Splash 项目教程

Scrapy-Splash 项目教程

scrapy-splashScrapy+Splash for JavaScript integration项目地址:https://gitcode.com/gh_mirrors/sc/scrapy-splash

1. 项目的目录结构及介绍

Scrapy-Splash 项目的目录结构如下:

  1. scrapy-splash/

  2. ├── scrapy_splash/

  3. │ ├── __init__.py

  4. │ ├── dupefilter.py

  5. │ ├── middleware.py

  6. │ ├── request.py

  7. │ ├── response.py

  8. │ ├── __pycache__/

  9. │ └── utils.py

  10. ├── tests/

  11. │ ├── __init__.py

  12. │ ├── test_dupefilter.py

  13. │ ├── test_middleware.py

  14. │ ├── test_request.py

  15. │ ├── test_response.py

  16. │ └── test_utils.py

  17. ├── .gitignore

  18. ├── LICENSE

  19. ├── README.md

  20. ├── requirements.txt

  21. └── setup.py

目录结构介绍

  • scrapy_splash/: 包含 Scrapy-Splash 的核心代码文件。
    • __init__.py: 初始化文件。
    • dupefilter.py: 去重过滤器。
    • middleware.py: 中间件。
    • request.py: 请求处理。
    • response.py: 响应处理。
    • utils.py: 工具函数。
  • tests/: 包含测试文件。
    • __init__.py: 初始化文件。
    • test_dupefilter.py: 去重过滤器测试。
    • test_middleware.py: 中间件测试。
    • test_request.py: 请求处理测试。
    • test_response.py: 响应处理测试。
    • test_utils.py: 工具函数测试。
  • .gitignore: Git 忽略文件。
  • LICENSE: 许可证文件。
  • README.md: 项目说明文档。
  • requirements.txt: 依赖包列表。
  • setup.py: 安装脚本。

2. 项目的启动文件介绍

Scrapy-Splash 项目的启动文件主要是 setup.py。该文件用于安装 Scrapy-Splash 库。

setup.py 文件介绍

setup.py 文件内容如下:

  1. from setuptools import setup, find_packages

  2. setup(

  3. name='scrapy-splash',

  4. version='0.7.2',

  5. description='Scrapy+Splash for JavaScript integration',

  6. long_description=open('README.md').read(),

  7. long_description_content_type='text/markdown',

  8. author='Scrapinghub',

  9. author_email='info@scrapinghub.com',

  10. url='https://github.com/scrapy-plugins/scrapy-splash',

  11. license='BSD',

  12. packages=find_packages(exclude=['tests']),

  13. install_requires=[

  14. 'scrapy>=1.0',

  15. 'Twisted>=16.0',

  16. 'requests>=2.17',

  17. ],

  18. classifiers=[

  19. 'Development Status :: 5 - Production/Stable',

  20. 'License :: OSI Approved :: BSD License',

  21. 'Intended Audience :: Developers',

  22. 'Operating System :: OS Independent',

  23. 'Programming Language :: Python',

  24. 'Programming Language :: Python :: 2',

  25. 'Programming Language :: Python :: 2.7',

  26. 'Programming Language :: Python :: 3',

  27. 'Programming Language :: Python :: 3.4',

  28. 'Programming Language :: Python :: 3.5',

  29. 'Programming Language :: Python :: 3.6',

  30. 'Programming Language :: Python :: 3.7',

  31. 'Programming Language :: Python :: 3.8',

  32. 'Programming Language :: Python :: 3.9',

  33. 'Framework :: Scrapy',

  34. 'Topic :: Internet :: WWW/HTTP',

  35. 'Topic :: Software Development :: Libraries :: Python Modules',

  36. ],

  37. )

启动文件介绍

  • name: 项目名称。
  • version: 项目版本。
  • description: 项目描述。
  • long_description: 详细描述,通常从 README.md 文件读取。
  • author: 作者。
  • author_email: 作者邮箱。
  • url: 项目主页。
  • license: 许可证。
  • packages: 包含的包。
  • install_requires: 依赖包列表。

scrapy-splashScrapy+Splash for JavaScript integration项目地址:https://gitcode.com/gh_mirrors/sc/scrapy-splash

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...