R에서 POST로 사이트 내용 가져오기 :: R을 이용한 웹 크롤링 - mindscale
Skip to content

R에서 POST로 사이트 내용 가져오기

httr 라이브러리를 불러온다

library(httr)

rvest 라이브러리를 불러온다

library(rvest)

POST 함수를 이용해 모바일 게임 랭킹 사이트 1월 첫째 주 모바일 게임 랭킹을 찾는다

r = POST('http://www.gevolution.co.kr/score/gamescore.asp?t=3&m=0&d=week',
            encode = 'form', 
            body=list(txtPeriodW = '2016-01-02'))

받아온 결과에서 HTML을 읽는다

game = read_html(r)

rvest 라이브러리의 html 함수를 이용해 게임 제목을 추출한다

title2 = html_nodes(game, 'a.tracktitle')
title2 = html_text(title2)
title2[1:10]