Skip to main content

A mini framework of image crawlers

Project description

PyPI Version Python

Introduction

Documentation: http://icrawler.readthedocs.io/

This package is a mini framework of web crawlers. With modularization design, it can be extended conveniently. It supports media data like images and videos very well, and can also be applied to texts and other type of files. Scrapy is heavy and powerful, while icrawler is tiny and flexible.

With this package, you can write a multiple thread crawler easily by focusing on the contents you want to crawl, avoiding some troublesome problems like exception handling, thread scheduling and communication.

It also provides built-in crawlers for popular image sites like flickr and search engines such as Google, Bing and Baidu. If you want to add your own crawlers into built-in, welcome for pull requests.

Requirements

Python 2.7+ or 3.4+ (recommended).

Samples

Using builtin crawlers is very simple.

from icrawler.builtin import GoogleImageCrawler

google_crawler = GoogleImageCrawler(parser_threads=2, downloader_threads=4,
                                    storage={'root_dir': 'your_image_dir'})
google_crawler.crawl(keyword='sunny', max_num=1000,
                     date_min=None, date_max=None,
                     min_size=(200,200), max_size=None)

Writing your own crawlers with this framework is also convenient, see the tutorials.

Structure

A crawler consists of 3 main components (Feeder, Parser and Downloader), they are connected with each other with FIFO queues. The workflow is shown in the following figure.

  • url_queue stores the url of pages which may contain images

  • task_queue stores the image url as well as any meta data you like, each element in the queue is a dictionary and must contain the field img_url

  • Feeder puts page urls to url_queue

  • Parser requests and parses the page, then extracts the image urls and puts them into task_queue

  • Downloader gets tasks from task_queue and requests the images, then saves them in the given path.

Feeder, parser and downloader are all thread pools, so you can specify the number of threads they use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

icrawler-0.3.7.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

icrawler-0.3.7-py2.py3-none-any.whl (31.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file icrawler-0.3.7.tar.gz.

File metadata

  • Download URL: icrawler-0.3.7.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for icrawler-0.3.7.tar.gz
Algorithm Hash digest
SHA256 0599b33fb96c5ee6fefc57f3ad33daa9c2f98265f2a50a878c8e52c70e557d6b
MD5 14229f443a721bfb33fff71c404a4508
BLAKE2b-256 7a63e7dd201e4bb3a7f4c5bb1be0f06efda4694a3a37c0f8df096c122b61a1d2

See more details on using hashes here.

File details

Details for the file icrawler-0.3.7-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for icrawler-0.3.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 752ea9535275441ed396d49a560b6238f157fe85a69abfad6ed100c3bd8e9a16
MD5 f384130728e7f3ff501927f6185a28e9
BLAKE2b-256 842a2182c3812f2d5a6243ff56291eadd0750ba59fda1dbf81753e36e0d3d7b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page