【Python】google-images-download の使い方

公式でエラー出るのでパッチの方をダウンロード
100件までしかダウンロードできないらしいが, 私の用途だと20件程度で良かったので今のところ十分.

$ git clone https://github.com/Joeclinton1/google-images-download.git
$ cd google-images-download
$ sudo python setup.py install

使い方の例

JSONから引数取得
$ googleimagesdownload -cf example.json
検索キーワード, 検索上限
$ googleimagesdownload --keywords "Polar bears, baloons, Beaches" --limit 20
接頭辞検索

車について検索したい. 「赤い車」「青い車」「白い車」の順に検索したい場合

$ googleimagesdownload --k "car" -sk 'red,blue,white' -l 10
short hand command

\--limitを-l, --keywordを-kとしてもよい.

$ googleimagesdownload -k "Polar bears, baloons, Beaches" -l 20
画像ファイルではなく画像のリンクをダウンロードする
$ googleimagesdownload -k "sample" -u <google images page URL>
デフォルトディレクトリのdownload/ではなく, 指定したディレクトリに保存する
$ googleimagesdownload -k "boat" -o "boat_new"
URL指定で一つの画像をダウンロードする
$ googleimagesdownload --keywords "baloons" --single_image <URL of the images>