네이버 게임 라운지 게시글 댓글 크롤링
571
프로그램초
작성한 질문수 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
Issuance 테이블에 status, couponId 인덱스가 꼭 필요할까요?
2
24
1
상금은 언제 받을 수 있나요?
2
35
0
화면 깜박임 현상
2
61
1
17강 강의에 목데이터 첨부파일이 없습니다.
2
68
2






