• 카테고리

    질문 & 답변
  • 세부 분야

    업무 자동화

  • 해결 여부

    미해결

GuessedAtParserWarning가 뜨고 r의 타입이 다르게 나옵니다

20.08.04 20:54 작성 조회수 448

0

C:\Users\hyoyi\PycharmProjects\crawling\venv\Scripts\python.exe C:/Users/hyoyi/PycharmProjects/crawling/google.py

무엇을 검색할까요? : 파이썬

<class 'bs4.element.ResultSet'>

C:/Users/hyoyi/PycharmProjects/crawling/google.py:13: GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 13 of the file C:/Users/hyoyi/PycharmProjects/crawling/google.py. To get rid of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup constructor.

  soup = BeautifulSoup(html)

<class 'bs4.element.ResultSet'>

Process finished with exit code 0

오류랑 r타입이 다르게 나오는 것을 어떻게 해결하나요?

답변 2

·

답변을 작성해보세요.

0

hyohead2님의 프로필

hyohead2

질문자

2020.08.07


답변 감사합니다!

from
urllib.parse import quote_plus
from bs4 import BeautifulSoup
from selenium import webdriver

baseUrl = "https://www.google.com/search?q="
plusUrl = input("무엇을 검색할까요? : ")
url = baseUrl + quote_plus(plusUrl)

driver = webdriver.Chrome()
driver.get(url)

html = driver.page_source
soup = BeautifulSoup(html)

r = soup.select(".r")
print(type(r))


0

작성한 코드를 에러메세지와 함께 올려주세요.