본문 바로가기
프로그래머/프로그래밍

파이썬 구글 이미지 크롤링

by plog 2019. 12. 11.
# 참고: https://google-images-download.readthedocs.io/en/latest/examples.html
# pip install google_images_download
from google_images_download import google_images_download

def ImageCrawling(keyword, dir):
response = google_images_download.googleimagesdownload()

arguments = {"keywords":keyword # 키워드
,"limit":50 # 이미지 크롤링 수
,"print_urls":True # 출력 여부
,'output_directory':dir} #이미지 저장 장소
paths = response.download(arguments) #passing the arguments to the function
print(paths) #printing absolute paths of the downloaded images

# 여러 검색어 검색:'Polar bears,baloons,Beaches' 꼼마로 구분 된다. 각각 폴더로 생성
ImageCrawling('오재원','d:/lg/')


댓글