I am using decode_short_url of the twitteR package to decode shortened URLs from Twitter posts, but I am not able to get the desired results, It is always giving back the same results such as:
decode_short_url(decode_short_url("http://bit.ly/23226se656"))
## http://bit.ly/23226se656
## [1] "http://bit.ly/23226se656
UPDATE I wrapped this functionality in a package and managed to get it on CRAN same-day. Now, you can just do:
You can pass in a vector of URLs and get a
data_frame/data.frameback in that form.That particular bit.ly URL gives a
404error. Here's a version ofdecode_short_urlthat has an optionalcheckparameter that will attempt aHEADrequest and throw a warning message for any HTTP status other than 200.You can further modify it to return
NAin the event the "expanded" link 404's (I have no idea what you need this to really do in the event the link is bad).NOTE that the addd
HEADrequest will significantly slow the process down, so you may want to do a first pass withcheck=FALSEto a separate column, then compare which weren't "expanded", then check those withcheck=TRUE.You might also want to rename this to avoid namespace conflicts with the one from
twitteR.