Skip to content

This is a mini size crawler made by Python3. It's easy to use and extend. Good for study.

License

Notifications You must be signed in to change notification settings

ibio/mini-crawler

Repository files navigation

Mini Crawler

This is a mini size crawler made by Python3. It's easy to use and extend. Good for study. Simply crawler every item on a page and save it into local csv file. Then go to the next page.

Main Features

  • Save every item on the page into cvs and then go to the next page
  • Pause and rerun
  • Suppoer almost all kernels (PhantomJS, Firefox etc.)
  • Also can use Requests for those static pages, speed up

Used Packages

  • requests
  • selenium
  • time
  • csv
  • os
  • pickle
  • datetime
  • shutil
  • numpy
  • pandas
  • BeautifulSoup4
  • re
  • math

Main difference from Scrapy

  • Easy to maintain
  • Simple enough to use and extend
  • Less Memory leak

Architecture overview

alt text

Main files

minicrawler/spider/basespider.py

  • crawl
  • getTotalKeys (leave it to sub class)
  • getCurrentPage (leave it to sub class)
  • gotoNextPage (leave it to sub class, optional)
  • saveCurrentIndex
  • saveContentToWorkbook

minicrawler/provider/requestor.py

minicrawler/provider/webbrowser.py

  • load
  • getContent (leave it to different kernel)
  • navigate (leave it to different kernel)
  • quit

Three different examples

A Wikipedia (static page)

minicrawler/spider/richspider.py

B US news (dynamic with url pagination)

minicrawler/spider/nuspider.py

C Startclass (dynamic with button pagination)

minicrawler/spider/salaryspider.py

About

This is a mini size crawler made by Python3. It's easy to use and extend. Good for study.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages