Reputation: 33
I'm fairly new to programming and can't figure out how to submit an image to Twitter using the twitterR package. I want to submit an image from a website to Twitter hourly.
This is my script so far. I need help with the command to send an image to Twitter!
library(twitteR)
library(httr)
ckey <- "X"
csecret <- "X"
atoken <- "X"
asecret <- "X"
setup_twitter_oauth(ckey, csecret, atoken, asecret)
tweet("")
Upvotes: 3
Views: 644
Reputation: 827
There is a parameter in tweet() and updateStatus() called mediaPath which you can use to submit images. Try something like:
tweet("some status", mediaPath = "url-to-image.jpg")
Edit: media needs to be local or if it's a URL then it needs to have been uploaded to Twitter, which can also be done with the API, but not through twitteR I believe.
Upvotes: 6