Permalink
Browse files

start of twitteR function to extract links to publications

  • Loading branch information...
1 parent 6460cb6 commit a37ebd8e27998c4773100d1356c7a808a5fc6937 @cboettig committed Aug 22, 2012
Showing with 26 additions and 0 deletions.
  1. +26 −0 twitteR_cred.R
View
@@ -0,0 +1,26 @@
+library(ROAuth)
+library(twitteR)
+
+reqURL = "https://api.twitter.com/oauth/request_token"
+accessURL = "http://api.twitter.com/oauth/access_token"
+authURL = "http://api.twitter.com/oauth/authorize"
+twitCred <- OAuthFactory$new(consumerKey=getOption("TwitterKey"),
+ consumerSecret=getOption("TwitterSecret"),
+ requestURL=reqURL,
+ accessURL=accessURL,
+ authURL=authURL)
+
+twitCred$handshake() ## Authenticate in browser
+
+registerTwitterOAuth(twitCred)
+
+
+extractURLs <- function(text){
+ indices <- grep(".*(http://\\S.*).*", text)
+ # modify for multiple urls
+ urls <- gsub(".*(http://\\S.*).*", "\\1 ", df$text[indices])
+}
+
+
+
+

0 comments on commit a37ebd8

Please sign in to comment.