Last active
August 14, 2019 07:20
-
-
Save mrchypark/b709117a7b9be0ebfcdc2b620d50cca0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
library(dplyr) | |
library(purrr) | |
library(writexl) | |
tar <- "https://kreditjob.com/api/dashboard/filter" | |
body <- list("bjd_code"= F, | |
"data_ym"= "1903", | |
"industry"= F, | |
"max_prsn"= F, | |
"max_prsn_ratio"= F, | |
"max_salary"= F, | |
"max_sales"= F, | |
"min_prsn"= F, | |
"min_prsn_ratio"= F, | |
"min_salary"= F, | |
"min_sales"= F, | |
"only_good_cmpn"= F, | |
"order"= "DESC", | |
"page"= 1, | |
"size"= 5, | |
"sort"="SALES_VALUE") | |
POST(tar, body = body, encode = "json") %>% | |
content() %>% | |
with(total_count) -> | |
cnt | |
size <- 1000 | |
1:(as.integer(cnt/size)+1) %>% | |
map( | |
~ list( | |
"bjd_code" = F, | |
"data_ym" = "1903", | |
"industry" = F, | |
"max_prsn" = F, | |
"max_prsn_ratio" = F, | |
"max_salary" = F, | |
"max_sales" = F, | |
"min_prsn" = F, | |
"min_prsn_ratio" = F, | |
"min_salary" = F, | |
"min_sales" = F, | |
"only_good_cmpn" = F, | |
"order" = "DESC", | |
"page" = .x, | |
"size" = size, | |
"sort" = "SALES_VALUE" | |
) | |
) %>% | |
map_dfr( | |
~ POST(tar, body = .x, encode = "json") %>% | |
content() %>% | |
with(list) %>% | |
map_dfr(~ as_tibble(.x) %>% | |
when(.$OPEN_YN == "0" ~ tibble(), | |
~ .)) | |
) -> | |
krdj | |
write_xlsx(krdj, "krdj.xlsx") |
제가 괄호들 덜 썼네요
사과드립니다!
for(i in 1:(as.integer(cnt/size)+1))
{
bodys <-
list(
"bjd_code" = F,
"data_ym" = "1903",
"industry" = F,
"max_prsn" = F,
"max_prsn_ratio" = F,
"max_salary" = F,
"max_sales" = F,
"min_prsn" = F,
"min_prsn_ratio" = F,
"min_salary" = F,
"min_sales" = F,
"only_good_cmpn" = F,
"order" = "DESC",
"page" = i,
"size" = size,
"sort" = "SALES_VALUE"
)
POST(tar, body = bodys, encode = "json") %>%
content() %>%
with(list) %>%
map_dfr(~ as_tibble(.x) %>%
when(.$OPEN_YN == "0" ~ tibble(),
~ .)
) ->
krdj
file_name <- paste0("krdj",i,".xlsx")
write_xlsx(krdj, file_name)
}
👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
뭔가 R 언어에 오해가 있으신건지 모르겠네요.
아래 코드를 수행해보시면 좋을 것 같습니다.