ぽんぽこ日記

このブログはタヌキによって書かれています

ラーメン二郎のスクレイピング

最近ダイエットしていて、ラーメン二郎を食べていないので画像をスクレイピングしてみました。

pip install icrawler

ドキュメント

from icrawler.builtin import GoogleImageCrawler
img_path = 'your_image_dir/zirou2' # 保存先のディレクトリパス
google_crawler = GoogleImageCrawler(storage={'root_dir': img_path})
google_crawler.crawl(keyword='二郎', max_num=10)
filters = dict(
    size='large',
    color='orange',
    license='commercial,modify',
    date=((2022, 4, 1), (2022, 4, 15)))
google_crawler.crawl(keyword='二郎', filters=filters, offset=0, max_num=1000,
                     min_size=(200,200), max_size=None, file_idx_offset=0)

色々設定できるみたい。
type – “photo”, “face”, “clipart”, “linedrawing”, “animated”.
color – “color”, “blackandwhite”, “transparent”, “red”, “orange”, “yellow”, “green”, “teal”, “blue”, “purple”, “pink”, “white”, “gray”, “black”, “brown”.
size – “large”, “medium”, “icon”, or larger than a given size (e.g. “>640x480”), or exactly is a given size (“=1024x768”).
license – “noncommercial”(labeled for noncommercial reuse), “commercial”(labeled for reuse), “noncommercial,modify”(labeled for noncommercial reuse with modification), “commercial,modify”(labeled for reuse with modification).
date – “pastday”, “pastweek”