Shafiq Shafiq - 1 month ago 5x
R Question

How to get latest news posted on twitter by a website

I am using R and I need to retrieve the few most recent posts from a Twitter user (@ExpressNewsPK) using twitteR api. I have created an account and have an access token, etc. I have used the following command to extract the tweets:

express_news_tweets <- searchTwitter("@ExpressNewsPK", n = 10, lang = "en" )

However, the posts that are returned aren't the most recent ones from this user. Where have I made a mistake?


I think searchTwitter would search with the search string provided (here @ExpressNewsPK). So instead of giving tweets by @ExpressNewsPK it would give tweets which are directed to @ExpressNewsPK.

To get tweets from @ExpressNewsPK, you have a function named userTimeline which would give tweets from a particular user.

So after you are done with setup_twitter_oauth, you can try


read more about it at ?userTimeline