Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. # COLLECT THE DATES
  2. for (i in urls3) {
  3. addurl <- i
  4. discussion <- read_html(i, timeout = 1000000000)
  5. usernames <- discussion %>%
  6. html_nodes(".lia-component-message-view-widget-author-username a") %>%
  7. html_text()
  8. all.usernames <- append(all.usernames, usernames)
  9. datetime <- discussion %>%
  10. html_nodes(".local-friendly-date")
  11. datetime <- str_extract(datetime, "[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2} [A-Z]{2}")
  12. datetime <- parse_date_time(datetime, "%Y-%m-%d %H:%M:%p", tz = "US/Eastern")
  13. datetime <- as.character(datetime)
  14. date.posted <- datetime[1]
  15. date.replied <- datetime[2]
  16. date.difference <- difftime(datetime[2],datetime[1], units=c("mins"))
  17.  
  18. new.table <- rbind(new.table,c(addurl, date.posted, date.replied, date.difference))
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement