강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của hyohead24936
hyohead24936

câu hỏi đã được viết

Python pyautogui, kiến ​​thức cơ bản về thu thập thông tin beautifulsoup để tự động hóa tác vụ

Cập nhật 2022 - Python Web crawling: Lấy kết quả tìm kiếm thứ hạng bảng xếp hạng thời gian thực Melon TOP100 - Cách sử dụng cơ bản beautifulsoup, requests

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

Viết

·

690

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타입이 다르게 나오는 것을 어떻게 해결하나요?

웹-크롤링python

Câu trả lời 2

0

hyohead2님의 프로필 이미지
hyohead2
Người đặt câu hỏi


답변 감사합니다!

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

kimfl님의 프로필 이미지
kimfl
Người chia sẻ kiến thức

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

Hình ảnh hồ sơ của hyohead24936
hyohead24936

câu hỏi đã được viết

Đặt câu hỏi