네이버 게임 라운지 게시글 댓글 크롤링
549
프로그램초
작성한 질문수 3
0
크롤링 하다가 막혔는데 어떻게 해결할 수 있을까요??
URL : https://game.naver.com/lounge/Viking_Rise/board/detail/2583518
사용 코드
import requests
from bs4 import BeautifulSoup
import openpyxl
url = "https://game.naver.com/lounge/Viking_Rise/board/detail/2583518"
response = requests.get(url)
html = response.text
soup = BeautifulSoup(html, "html.parser")
comment_items = soup.select(".comment_item_text__1foPs")
workbook = openpyxl.Workbook()
sheet = workbook.active
sheet.title = "Crawled Comments"
sheet.cell(row=1, column=1, value="Comment Text")
sheet.cell(row=1, column=2, value="Attributes")
for index, comment_content in enumerate(comment_items, start=2):
comment_text = comment_content.get_text(strip=True)
comment_attributes = str(comment_content.attrs)
sheet.cell(row=index, column=1, value=comment_text)
sheet.cell(row=index, column=2, value=comment_attributes)
workbook.save("crawled_comments.xlsx")
print("Comment attributes have been crawled and saved to crawled_comments.xlsx")
답변 1
수업 잘 들었습니다.
2
25
2
맥유저 입장의 고려해주세요
2
74
1
실행과정 질문입니다.
2
24
1
케이테스트 서버 운영 방법
2
52
1






