Display a chosen users tweets using twitter api in a rails app - ruby-on-rails

I am trying to display a chosen users tweets in my rails app. Right now the way I have it, it is pulling up their tweets and any time they are mentioned. I just want the tweets that they post and nothing else. I will not have their log in info. This will just work for public accounts. This is the code I have so far.
client.search(user_id=#band.twitter).take(20).collect do |tweet|
the #band.twitter is where I am storing the bands twitter handle.
Any help would be much appreciated.

This seemed to have Worked for me.
client.user_timeline(#band.twitter).take(20).collect do

Related

Beginner Question: How to access the number of impressions from *other users'* tweets?

I've got a bunch of free online HTML, CSS, and JS tutorials under my belt and I want to try using them to make a browser extension. But I want to make sure that the data I want to use is actually accessible before getting started.
My goal is to make a browser extension for twitter.com that shows the number of impressions of any tweet next to the likes, retweets, and replies. My basic idea is to get the status URL of any given tweet, poll the Twitter API for the number of impressions of that tweet, store that in a variable, and then use CSS to display a little eye icon and the number stored in the impressions variable.
I know that I can find the number of impressions of all of my tweets, both through Twitter Analytics, and also just going to my profile page and clicking the little bar chart icon next to views, retweets, etc. But I'm not clear on whether I can do that for other people's tweets via Twitter's API or anything else. Can you?
For the record, I'm not too concerned about the varying definition of "impression," since it will be consistently applied across all tweets and I'm mostly interested in giving users a comparison between tweets. This is part of a research project to see how this might change how people engage with social media if they know how many views a given post has. If there's a simpler way to go about that using existing platforms, I'm open to suggestions.
Thanks for the advice!
No, impressions data is private. If you are authenticated to the Twitter API then you can use the new Twitter Developer Labs Tweets API to get private metrics like impressions, but you cannot get that for other people's Tweets. Also, the Twitter API does not support CORS, so I don't think you'll be successful trying to use it from a browser extension.

How can I save tweets of a user as images?

There is a Twitter user who posts valuable stuff and I want to save his tweets not as text but as images (screenshots) just as you see it on your phone or computer.
I installed python-twitter and tweepy but I didn't find a solution in the docs and neither in communities so far.
Alternatively: Is there another way to save tweets in a kind of pretty, visually appealing way?
Thank you in advance.
With those libraries you can only extract Twitter data. Those aren't image processing libraries. You will have to write your own logic how you want those pictures displayed.
Look into Pillow.
I usually use this site called tweetcyborg.com It converts any tweet into an image.
I figured it out. Using Selenium Webdriver to open the Twitter account page in the browser, then scrape the tweets and use a screenshot tool to make an image. This looping through all tweets.

dynamic twitter widget id

I want to use the new twitter embedded timelines (https://dev.twitter.com/docs/embedded-timelines) but how can I get the data for the right user by username? I have a lot of websites with users (>500) who have their username in the database but as far as I can see you have to give a data-widget-id to get the tweets from the right user.
Is there any way to do this by username? And if not, how can I quickly convert all my users' data-widget-id to the database?
Any help is appreciated
Looks like the best you can do is get a single valid data-widget-id and use it for many different user names using the data-screen-name property.
There is a discussion here from one of the twitter devs. The same one as #alex_b posted in the comments.
You can wrote same script for PHP, for Rails community this gits could be helpfull to get widget-id dynamically.
https://gist.github.com/shah743/dd042df63a8f307f16ed

Getting Twitter data from RoR app

I have a RoR 3 application and I'm trying to integrate it with Twitter. So what do I need?
I need to count how many tweets with a certain hashtag (like #awesometag) were tweeted by users that follow me.
There are many ways to do this, as I saw while searching online. However, I want to know the most reliable way to do this.
Thanks!
There is a Twitter gem for all this stuff. If im not mistaken there is a Search class for doing what you want. More info about this gem

Searching tweets published from Delicious with Twitter API

I am a new user in StackOverflow. I am developing a tool.
My problem is that I am trying get tweets published from Delicious ("X minutes ago via Delicious").
In Twitter API Documentation (https://dev.twitter.com/doc/get/search), I can see:
Originating from an application:
http://search.twitter.com/search.atom?q=landing+source:tweetie
I am copy & paste "http://search.twitter.com/search.atom?q=landing+source:tweetie" in web navigator. The example from Twitter API don't work!!! :S
However, I am trying others search applications, and WORK:
http://search.twitter.com/search.atom?q=landing+source:TweetDeck
http://search.twitter.com/search.atom?q=landing+source:twitterfeed
http://search.twitter.com/search.atom?q=landing+source:ping.fm
http://search.twitter.com/search.atom?q=landing+source:web
http://search.twitter.com/search.atom?q=landing+source:SocialOomph
http://search.twitter.com/search.atom?q=landing+source:tumblr
But when I try to search for Delicious, don't work:
http://search.twitter.com/search.atom?q=landing+source:Delicious
Why? I am try next, and don't work:
http://search.twitter.com/search.atom?q=landing+source:del.icio.us
http://search.twitter.com/search.atom?q=landing+source:icio.us
Exists solution to http://search.twitter.com/search.atom?q=landing+source:Delicious?
I am try to access to Twitter API IRC, but don't work... :S
Thank you very much, and I sorry my bad English. Regards! :)
With landing+source:Delicious there are no search results because there frankly aren't any recent tweets containing "landing" that were tweeted using Delicious.
The other source applications contain results because people have been tweeting "landing" using other apps, as you've noted.
But source:Delicious does work; try searching for other terms, like food+source:Delicious or happy+source:Delicious and you should see results.

Resources