使用Python批次下載Google圖片

Yanwei Liu
3 min readApr 25, 2019

--

#20200304更新:目前已失效,請改用flickr_scraper

google-images-download

安裝

pip install google_images_download

預設下載資料夾

C:\Users\Yanwei\Downloads

使用

#分別下載指定名稱各20張圖片
googleimagesdownload --keywords "Polar bears, baloons, Beaches" --limit 20
#下載指定格式圖片
googleimagesdownload --keywords "logo" --format svg
#下載到指定目錄
googleimagesdownload -k "boat" -o "G:\"
#下載指定使用版權
googleimagesdownload --keywords "universe" --usage_rights labeled-for-reuse
#下載指定網址內的圖片
googleimagesdownload --keywords "universe" --specific_site example.com
#20190904更新,出現找不到chromedriver.exe(加入參數即可解決)
googleimagesdownload --keywords "水雉" --limit 1000 --chromedriver C:\users\Yanwei\chromedriver.exe

AutoCrawler

安裝與使用

1.Install Chrome2.pip install -r requirements.txt3.Write search keywords in keywords.txt4.Run “main.py”5.Files will be downloaded to ‘download’ directory.

使用參數

python main.py [--skip true] [--threads 4] [--google true] [--naver true] [--full false] [--face false]--skip true   #如果下載目錄存在,則略過關鍵字 

--threads 4 #使用"4"線程進行下載

--google true #從Google下載

--naver true #從Naver下載
--full false #下載高解析度圖片

--face flase #臉部搜尋模式

--

--

No responses yet