목록Crawling (3)
Joirv
크롤링을 통해 연세대학교 홈페이지에서 학사 일정을 가져와보자. 귀찮아서 2-3월 학사 일정만 가져왔지만, 같은 과정 반복하면 이후도 가져올 수 있다. 시작에 앞서, 프런트에 대한 지식, html에 관한 지식이 전무하기 때문에 비효율적인 코드일 가능성이 높다. 1. 필요한 모듈 불러오기 import selenium from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup import panda..
from selenium.webdriver import Chrome browser = Chrome() 위와 같이 크롬 브라우저를 열기 위한 코드를 작성하면 다음과 같은 오류가 떴다. Colab에서 실행했을 때 생긴 오류여서 jupyter notebook으로 넘어왔는데, 넘어와서도 같은 문제가 발생했다. WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home 이럴 때에는 아래와 같이 해결하면 해결된다! from webdriver_manager.chrome import ChromeDriverManager b..
from bs4 import BeautifulSoup 주피터 노트북에서 크롤링 하려고 bs4를 import 하면 아래와 같은 에러가 뜬다. ModuleNotFoundError: No module named 'bs4' 어이가 없게도 "No module named 'bs4'" 에러가 뜬다. 분명 pip, pip3, conda 등 동원할 수 있는 모든 방법으로 bs4를 설치했는데도 다음과 같은 오류가 떠서 고생했는데, 방법은 의외로 간단했다. 경로를 추가해주면 되는 것이다. import sys sys.path.append("/opt/anaconda3/lib/python3.9/site-packages") 참고 https://stackoverflow.com/questions/66600718/jupyter-note..