skip to content
barorin&

icrawlerを使ってみる

/ 1 min read

Table of Contents

はじめに

サーチエンジン、SNS から画像を取得できるクローラーである icrawler を使ってみます。
Welcome to icrawler — icrawler 0.6.3 documentation

方法

ビルトインされているクローリング機能

  • Google ※今は使えないみたいです。
  • Bing
  • Baidu
  • Flickr
  • General greedy crawl (crawl all the images from a website)
  • UrlList (crawl all images given an url list)

Bing で猫の画像検索をする場合

from icrawler.builtin import BingImageCrawler
filters = dict(size='large')
bing_crawler = BingImageCrawler(downloader_threads=4,
storage={'root\_dir': 'your\_image\_dir'})
bing_crawler.crawl(keyword='猫', filters=filters, offset=0, max_num=1000)

この記事を書いた人

barorinのプロフィール画像

barorinCPA & Engineer

会計とITの二足のわらじで働く公認会計士です。Pythonを中心に、会計・監査の実務で使えるコードや、Ubuntu・Docker等の設定メモなどを書いています。