I would like to know how I can convert t.co URLs to Big URLs?
I have a dataset (named urls) with two variables: One variable is named “source_url”, which contains 7175 t.co shortened URLs (obtained from Twitter), and another variable which contains the frequency of each t.co URL (see the figure please). I would like to obtain the target URLs for the t.co URLs. I use the following codes to do so:
target_urls <- t(sapply(urls$source_url, GET)) %>%
as_tibble() %>%
select(target_url, status_code)
I, however, encounter the following error:
Error in curl::curl_fetch_memory(url, handle = handle) :
Failed to connect to jamaica-gleaner.com port 80: Connection refused
When I run the above codes on smaller datasets (e.g., the first or second or third 500 t.co URLs), it sometimes works well for some datasets, and sometimes gets the following errors:
Error in curl::curl_fetch_memory(url, handle = handle) :
Could not resolve host: my-news-feed.com
Error in curl::curl_fetch_memory(url, handle = handle) :
SSL certificate problem: certificate has expired
Error in curl::curl_fetch_memory(url, handle = handle) :
Could not resolve host: experience.safety
I wonder why I get these errors, how they can be fixed, and whether there is a better way to get the target URLS for t.co URLs?