[Python] 이미지 크로링 코드 페페 이미지를 Images폴더에 10개 저장- CrawlingConfig에 필요한 정보를 설정- SaveImage()호출시 UnsafeLegacyRenegotiation 이 발생하는 경우가 있는데 확인 필요 from selenium.webdriver import Chromefrom selenium.webdriver import ChromeOptions from selenium.webdriver.common.by import Byfrom selenium.webdriver import Keysimport sysimport osimport urllibfrom time import sleepimport ssl# 설정 정보class CrawlingConfig: def __init__(self) -> Non.. 2024. 9. 14. [Python] 이미지 크롤링 1. Selenium 패키지 설치python3 -m pip install seleniumSelenium 4 이상에서는 chromedriver를 따로 설치해줄 필요가 없음 2. 크롬 관련 모듈 임포트 하고 구글 접속from selenium.webdriver import Chromefrom selenium.webdriver import ChromeOptions # 브라우저 닫힘 방지# 해당 옵션을 설정해주지 않으면 스크립트가 종료될때 브라우저가 닫힌다chrome_options = ChromeOptions()chrome_options.add_experimental_option("detach", True)# 크롬을 열고 구글 접속driver = Chrome(chrome_options)driver.get("htt.. 2024. 8. 22. 이전 1 다음