본문 바로가기

Python_Crawling/Crawling

(27)
[Selenium]Python Study - PPT Presentation Material - 2 • 드라이버 조작 메서드명 설명 add_cookie(cookie_dict) 쿠키 값을 딕셔너리 형식으로 지정 back()/forward() 이전 페이지 또는 다음 페이지로 이동 close() 브라우저를 닫음 current_url 현재 URL을 추출 delete_all_cookies() 모든 쿠키를 제거 delete_cookie(name) 특정 쿠키를 제거 execute(command, params) 브라우저 고유의 명령어를 실행 execute_async_script(script, *args) 비동기 처리하는 자바스크립트를 실행 execute_script(script, *args) 동기 처리하는 자바스크립트를 실행 • 드라이버 조작 메서드명 설명 save_screenshot(filename) 스크린샷을 저..
[Selenium]Python Study - PPT Presentation Material - 1 • 웹 앱을 테스트하는데 이용하는 프레임워크 • webdriver라는 API를 통해 운영체제에 설치된 Chrome등의 브라우저를 제어 • 참고 : https://sites.google.com/a/chromium.org/chromedriver/downloads Downloads - ChromeDriver - WebDriver for Chrome WebDriver for Chrome sites.google.com • 참고 : https://www.seleniumhq.org SeleniumHQ Browser Automation If you want to create robust, browser-based regression automation suites and tests, scale and distribut..
[Crawling]Python Study - PPT Presentation Material - 4 • 기본 구조(3.16.html / 3.17.html) • #아이디 이름 정의 • id=아이디 이름 • 특정한 id 속성을 가지고 있는 태그 • 참고 : https://developer.mozilla.org/en-US/docs/Web/CSS/ID_selectors ID selectors The CSS ID selector matches an element based on the value of its id attribute. In order for the element to be selected, its ID attribute must match exactly the value given in the selector. developer.mozilla.org • 기본 구조(3.18.html) • 참고 : ..
[Crawling]Python Study - PPT Presentation Material - 3 • 기본 구조(3.4.html) • 순서 없는 목록 태그 • 기본 목록을 생성할 때 사용 • 웹페이지의 네비게이션 메뉴를 생성할 때에 사용 • 참고 : https://devdocs.io/html/element/ul DevDocs devdocs.io • 참고 : https://devdocs.io/html/element/li DevDocs devdocs.io • 기본 구조(3.5.html) • 표를 생성할 때 사용 • tr : 표 내부의 행 태그 • th : 행 내부의 제목 셀 태그 / 굵은글씨 / 머리말 • td : 행 내부의 일반 셀 태그 • table 태그에 들어가는 태그 : tr, td, th, col, colgroup,row, caption, tbody, tfoot, thead, summary • ..
[Crawling]Python Study - PPT Presentation Material - 2 • 참고 : https://javaplant.tistory.com/18 HTTP 응답코드 메소드 정리 GET, POST, PUT, PATCH, DELETE, TRACE, OPTIONS HTTP Request 정보 GET /index.html HTTP/1.1 요청 URL정보 (Mehotd /URI HTTP버젼) user-agent: MSIE 6.0; Window NT 5.0 사용자 웹 브라우져 종류 accept: test/html; */* 요청 데이터 타입 (응답의 Content-ty.. javaplant.tistory.com • GET • Body 없이 Header만 전송 • 링크 / 북마크 가능 • 요청 길이 제한 존재 • 쿼리 문자열 가능 • 쿼리 문자열은 key와 value로 구분 • 쿼리는 & 로..
[Crawling]Python Study - PPT Presentation Material - 1 • Python : https://www.python.org Welcome to Python.org The official home of the Python Programming Language www.python.org • Python Tutorial : https://docs.python.org/ko/3/tutorial/index.html 파이썬 자습서 — Python 3.8.1rc1 문서 파이썬 자습서 파이썬은 배우기 쉽고, 강력한 프로그래밍 언어입니다. 효율적인 자료 구조들과 객체 지향 프로그래밍에 대해 간단하고도 효과적인 접근법을 제공합니다. 우아한 문법과 동적 타이핑(typing)은, 인터프리터 적인 특징들과 더불어, 대부분 플랫폼과 다양한 문제 영역에서 스크립트 작성과 빠른 응용 프로그램 개..
[Study Group]Title + Price 가져오기(Crawling 후 CSV File 저장) Q> http://books.toscrape.com/catalogue/category/books/mystery_3/index.html Mystery | Books to Scrape - Sandbox £59.48 In stock books.toscrape.com 해당 사이트에서 Title 와 Price를 가져와서 CSV File 저장하기 A> 1. 크롤링할 부분 파악 빨간색 부분 Title / 노란색 부분 Price 초록색 부분 페이지 수 2. 가져올 부분 개발자 도구에서 파악 - Title - Price - Page 3. 크롤링 함수 모듈 작성 import requests from bs4 import BeautifulSoup # 특정 셀렉터에 대하여 파싱한 결과를 List로 반환 def select(se..
[Study Group]명언 + 위인 가져오기(selenium) from selenium import webdriver from selenium.webdriver.chrome.options import Options from bs4 import BeautifulSoup # Chrome Browser 옵션 사용 options = Options() # Chrome Browser 숨기기 모드 options.add_argument('headless') # chromedriver 및 options driver = webdriver.Chrome(executable_path='C:\\chromedriver\\chromedriver', options=options) # 3초 대기 driver.implicitly_wait(3) # 자동화 대상 Site driver.get('http:..