프로그래밍 공부/기록노트

이미지 크롤링(python, google_images_download)

sh1256 2022. 1. 23. 23:18
728x90

이전글(html크롤링--> https://sh1256.tistory.com/52?category=991734 )

 

1.  google_images_download 다운     --> https://pypi.org/project/google_images_download/

 

google_images_download

Python Script to download hundreds of images from 'Google Images'. It is a ready-to-run code!

pypi.org

문서 아이콘 클릭시 복사

터미널에 붙여넣기 (ctrl+shift+v)

그러면 설치된다. 

 

 

홈페이지에 있는 documentation에서 예제를 실행해보자.

Code sample - Importing the library 

소스코드를 실행해보자. (google.py파일을 따로 만들어서 실행해 봄)

터미널에 "python google.py" 입력 

그러면 왼쪽에 downloads 라는 파일이 하나 생성된다. 

소스코드에서 봤던 키워드들이 각각의 파일로 저장되어 있다. 

 

각각의 파일 안에는 키워드와 관련된 사진들이 20장씩 저장되어 있다. 

(그래야 하는데 무슨 일인지.. 오류가 뜬다..ㅠㅜ)

 

오류 해결 방법 --> https://skmouse.tistory.com/entry/%ED%8C%8C%EC%9D%B4%EC%8D%AC-%EA%B5%AC%EA%B8%80-%EC%9D%B4%EB%AF%B8%EC%A7%80-%ED%81%AC%EB%A1%A4%EB%A7%81uh-oh-keywords-is-a-required-argument-unfortunately-all-20-could-not-be-downloaded-because-some-images-were-not-downloadable-0-is-all-we-got-for-this-search-filter-1

 

파이썬 구글 이미지 크롤링(uh oh! keywords is a required argument, unfortunately all 20 could not be downloaded becaus

pypi.org/project/google_images_download/ google_images_download Python Script to download hundreds of images from 'Google Images'. It is a ready-to-run code! pypi.org 예시) from google_images_downlo..

skmouse.tistory.com

출처: skmouse.tistory.com