소스 검색

Corrected août

static
Maxime Wack 6 년 전
부모
커밋
17926056d5
1개의 변경된 파일20개의 추가작업 그리고 9개의 파일을 삭제
  1. +20
    -9
      feed_db.R

+ 20
- 9
feed_db.R 파일 보기

@@ -7,6 +7,25 @@ library(stringr)

annee <- 2017

# Fetch celine and data ----
celine <- GET(str_c("http://cngsante.fr/chiron", annee, "/celine/listing.html"))

celine %>%
content %>%
html_node("tr:first-child") %>%
html_text ->
timestamp

readRDS("prev_time.rds") -> prev_time

if (timestamp == prev_time)
{
q(save = "no")
} else
{
saveRDS(timestamp, file = "prev_time.rds")
}

db <- dbConnect(SQLite(), "ecn.db")

# Fetch previous state ----
@@ -18,14 +37,6 @@ db %>%
filter(timestamp == max(timestamp)) ->
current

# Fetch celine and data ----
celine <- GET(str_c("http://cngsante.fr/chiron", annee, "/celine/listing.html"))

celine %>%
content %>%
html_node("tr:first-child") %>%
html_text ->
timestamp

timestamp %>%
str_extract("\\d+h\\d+") %>%
@@ -46,7 +57,7 @@ date %>%
mois
case_when(mois == "jul" ~ "07",
mois == "sep" ~ "09",
mois %>% str_detect("^ao") ~ "08") ->
mois == "aoû" ~ "08") ->
mois

timestamp <- str_c(annee, "-", mois, "-", jour, " ", heure)


불러오는 중...
취소
저장