Last active
August 19, 2019 11:32
-
-
Save chenpanliao/307206a3d3f41b83af727a2a286f7c1b to your computer and use it in GitHub Desktop.
add timestamp
This file contains 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
FBlikeNumber <- | |
function(url) { | |
require(magrittr) | |
require(rvest) | |
x <- read_html(url, encoding = "UTF-8") %>% as.character | |
re <- regexpr("[,0-9]+(?= 人說這讚)", x, perl = T) | |
substr(x, re, re + attr(re, "match.length")) %>% | |
gsub(",", "", .) %>% | |
as.integer | |
} | |
FBlikeNumber("https://www.facebook.com/DoctorKoWJ/") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment