how to properly close connection so I won't get “Error in file(con, ”r“) : all connections are in use” when using “readlines” and “tryCatch”
问题 I have a list of URLs (more than 4000) from a specific domain (pixilink.com) and what I want to do is to figure out if the provided domain is a picture or a video. To do this, I used the solutions provided here: How to write trycatch in R and Check whether a website provides photo or video based on a pattern in its URL and wrote the code shown below: #Function to get the value of initial_mode from the URL urlmode <- function(x){ mycontent <- readLines(x) mypos <- grep("initial_mode = ",