Coder Social home page Coder Social logo

安装依赖

pip3 install BeautifulSoup4
pip3 install requests

使用

修改main.py 当前域名的https链接,sitemap.xml路径,抓取的最大栈深度,支持1-3,建议设置为2。

crawl = crawler.Crawler("https://91biquge.cc", "sitemap.xml", 2)
crawl.run()

修改完了之后执行main.py

抓取深度为2,耗时测试如下:

07/23/2020 20:59:30 PM - INFO - generate sitemap for https://91biquge.cc
07/23/2020 20:59:30 PM - INFO - sitemap generate take: 91 s
07/23/2020 20:59:30 PM - INFO - sitemap urls size is 98233 urls
07/23/2020 21:00:21 PM - INFO - generate sitemap for https://maddogreading.cc
07/23/2020 21:00:21 PM - INFO - sitemap generate take: 50 s
07/23/2020 21:00:21 PM - INFO - sitemap urls size is 142365 urls
07/23/2020 21:05:39 PM - INFO - generate sitemap for https://youku.91biquge.cc
07/23/2020 21:05:39 PM - INFO - sitemap generate take: 317 s
07/23/2020 21:05:39 PM - INFO - sitemap urls size is 150261 urls

存在的问题

当设置抓取深度为3时,耗时非常长。

shyboy0415's Projects

shyboy0415 doesn’t have any public repositories yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.