[Python] 리눅스 서버(centos7)에 파이썬 크롤러 환경 셋팅하기
·
Development/Linux
윈도우에서 테스트용으로 작성한 파이썬 크롤러를 리눅스에도 적용 시키려고 한다. python 버전 업그레이드 현재 centOS7환경을 사용 중이며, 기본적으로 python 2 버전대를 포함하고 있기 때문에 3으로 업그레이드한다. yum install python3.6 업그레이드는 아래 포스팅 참고👇🏻 https://dev-wisdom.tistory.com/141 [centOS7] Python 버전 업그레이드하기 centos7에는 기본적으로 Python 2.7.5 (default, Oct 14 2020, 14:45:30)가 설치되어있다. 현재 사용중인 python 코드의 버전은 3.7.9이여서 버전 업그레이드를 했다. # python -v Python 2.7.5 (default, Oct 14 2020, 14..
[selenium] 요소 선택이 안될 경우
·
Development/Python
셀레니움 사용하기 라이브러리 선언 상단에 필요한 라이브러리를 선언한다. from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.keys import Keys option 입력하기 필요한 option이 있다면 입력한다. header값을 입력해줄 수 있다. # chrome option options = webdriver.ChromeOptions() options.add_argument('--headless') options.add_argument('--no-sandbox') options.add_argument('--disable-gpu') options.add_argumen..
[Crawler] 특정 값 파싱 안될 때(ex. 작성자)
·
Development
특정 값 안나올 때 (ex. 작성자, 날짜 등)사이트내의 `network`에 검색했을 때도 안나오는 값일 경우,정상적으로 웹 파싱이 안되어서 값을 못불러오는 경우 일 수 있음. 그럴 경우 파싱넘겨주는 값을 수정한다1. `path` 추가2. `user-agent` 변경 (4.0 => 5.0)3. `cookie`값 추가 해주었더니 정상적으로 모든 값이 파싱됨.$strParseContent = "";$strParseContent .= "GET"; // POST, GET 선택$strParseContent .= " {$strParseSubURL} HTTP/1.0\r\n"; // 도메인이외의 파라미터값.$strParseContent .= "Host:{$strParseHost}\r\n"; // "http://" 제거..