mirror of
https://github.com/briatte/awesome-network-analysis.git
synced 2025-01-24 13:31:04 -05:00
Update check.r
This commit is contained in:
parent
dc5d1af045
commit
cfd8deddda
6
check.r
6
check.r
@ -25,7 +25,7 @@ if (!file.exists(f)) {
|
|||||||
u <- GET(u) %>%
|
u <- GET(u) %>%
|
||||||
content("text") %>%
|
content("text") %>%
|
||||||
str_split("\\n") %>% # so as to find [foo]: bar links
|
str_split("\\n") %>% # so as to find [foo]: bar links
|
||||||
unlist
|
unlist()
|
||||||
|
|
||||||
# total number of links (made to match web.archive.org links only once)
|
# total number of links (made to match web.archive.org links only once)
|
||||||
t <- sum(str_count(u, "(?<!/)http"))
|
t <- sum(str_count(u, "(?<!/)http"))
|
||||||
@ -36,10 +36,10 @@ if (!file.exists(f)) {
|
|||||||
# [foo](bar)
|
# [foo](bar)
|
||||||
str_extract_all(u, "\\(http(.*?)\\)") %>%
|
str_extract_all(u, "\\(http(.*?)\\)") %>%
|
||||||
lapply(str_replace_all, "^\\(|\\)$", "") %>%
|
lapply(str_replace_all, "^\\(|\\)$", "") %>%
|
||||||
unlist,
|
unlist(),
|
||||||
# [foo]: bar
|
# [foo]: bar
|
||||||
str_extract_all(u, "^\\[(.*)\\]: (.*)") %>%
|
str_extract_all(u, "^\\[(.*)\\]: (.*)") %>%
|
||||||
unlist %>%
|
unlist() %>%
|
||||||
str_replace("^\\[(.*)\\]: (.*)", "\\2")
|
str_replace("^\\[(.*)\\]: (.*)", "\\2")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user