오늘의 인기 글
최근 글
최근 댓글
Today
Total
05-19 08:40
관리 메뉴

우노

[Python] Google 이미지 크롤링 방법 본문

Language/Python

[Python] Google 이미지 크롤링 방법

운호(Noah) 2021. 9. 28. 12:46

진행 순서

  1. Google 이미지 크롤링 라이브러리 설치 (수정 버전)
  2. 이미지 크롤링 코드 작성 및 실행

1. Google 이미지 크롤링 라이브러리 설치 (수정 버전)

2. 이미지 크롤링 코드 작성 및 실행

  • Google Images Download Reference 의 Code Samples 참고

  • 이미지 크롤링 코드 작성 (crawling.py)

      #importing the library
      from google_images_download import google_images_download   
    
      #class instantiation
      response = google_images_download.googleimagesdownload()   
    
      # keywords : 원하는 검색 키워드
      # limit : 원하는 다운로드 사진 개수 (수정 버전에서는 최대 100개까지 가능)
      # format : 다운로드 확장자 지정
      arguments = {"keywords":"워너원 강다니엘, 엑소 백현, 박보검, 송중기, 워너원 황민현, 엑소 시우민, 강동원, 이종석, 이준기, 마동석, 조진웅, 조세호, 안재홍, 윤두준, 이민기, 김우빈, 육성재, 공유, BTS 정국, 아이콘 바비, 워너원 박지훈, 엑소 수호",
                              "limit":50,
                              "print_urls":True,
                              "format":"jpg"
                                  }
    
      #passing the arguments to the function
      paths = response.download(arguments)   
    
      #printing absolute paths of the downloaded images
      print(paths)   
  • 이미지 크롤링 코드 실행

      python crawling.py
Comments