API 로 데이터 수집하기
Steamreviews 로 리뷰 수집
1. steamreviews 설치
!pip install steamreviews -q
import steamreviews
print(f"steamreviews 설치 완료!")
-q 는 설치 과정을 조용히 ( quiet ) 출력
2. 리뷰 수집하기
import steamreviews
# 게임 ID 설정
app_id = 3159330
# 리뷰 수집
review_dict, query_count = steamreviews.download_reviews_for_app_id(
app_id,
chosen_request_params={'language': 'korean'}
)
print(f"수집된 리뷰 수 : {len(review_dict['reviews'])}")
print(f"API 요청 횟수 : {query_count}")
[appID = 3159330] expected #reviews = 1197
수집된 리뷰 수 : 1195
API 요청 횟수 : 13
3. 데이터 구조 살펴보기
first_review_id = list(review_dict['reviews'].keys())[0]
first_review = review_dict['reviews'][first_review_id]
print("리뷰 데이터 키 : ")
print(first_review.keys())
리뷰 데이터 키 :
dict_keys(['recommendationid', 'author', 'language', 'review',
'timestamp_created', 'timestamp_updated', 'voted_up', 'votes_up',
'votes_funny', 'weighted_vote_score', 'comment_count', 'steam_purchase',
'received_for_free', 'refunded', 'written_during_early_access',
'primarily_steam_deck', 'app_release_date', 'reactions'])
4. DateFrame 으로 변환
import pandas as pd
# 리뷰 데이터를 리스트로 변환
reviews_list = []
for review_id, review_data in review_dict['reviews'].items():
reviews_list.append({
'review_id': review_id,
'review': review_data['review'],
'voted_up': review_data['voted_up'],
'playtime_hours': review_data['author']['playtime_forever'] / 60,
'timestamp': review_data['timestamp_created']
})
# DateFrame 생성
df = pd.DataFrame(reviews_list)
print(df.head())
review_id review voted_up \
0 223599133 그냥 재미가 없음. 스토리 텔링은 극세사로 채썰어놔서 집중도 안되고, 브금은 무슨 ... False
1 223593245 [h1] 재미 없네요.. [/h1]\n\n오리진 오디세이 예약구매하고 \n발할라도 ... False
2 223435854 조온나 재밌음 True
3 223363922 역대 최고의 어쌔신 게임 !!\r\n오다 노부나가 세력에 맞서는 이가의 시노비 나오... True
4 223306698 처음에 말 많아서 이상할줄 알았는데 그정도는 아님 딱 어쌔신크리드 나름 잘 즐겼으면... True
playtime_hours timestamp
0 60.083333 1776581732
1 15.916667 1776574483
2 88.750000 1776423349
3 387.316667 1776335832
4 143.050000 1776259893
5. 저장된 파일 다운로드
df.to_csv('reviews.csv', index=False, encoding='utf-8-sig')
from google.colab import files
files.download('reviews.csv')
주의사항
- 속도문제
API 는 무제한으로 호출될 수가 없다.
짧은 시간 내에 많은 요청에는 주의가 필요하다. - 한국어 리뷰가 많지 않을 수 있다.
- Colab 런타임은 일정 시간 아무 활동이 없으면 끊길 수 있다.
노트북 문서는 사라지지 않지만, 실행 상태 ( 메모리 ) 는 일정 시간 아무것도 안하면 사라질수 있다.
'🤖AI Tools > AI 리뷰 분석' 카테고리의 다른 글
| Hades 리뷰 분석 (0) | 2026.04.22 |
|---|---|
| API 로 데이터 수집 2 (0) | 2026.04.22 |
| 데이터 수집 방법 (0) | 2026.04.21 |
| Python 정리 (0) | 2026.04.21 |
| 텍스트 리뷰 분석 (0) | 2026.04.14 |