Twitter API - search tweets and filter by bio keywords - twitter

Is there any way at all to search for latest tweets by keyword, then - crucially - only show the tweets when the twitter user it belongs to has a keyword in their bio? I've been searching for ways to do this and have found nothing other than sites (e.g FollowerWonk) which offer this functionality but not an API to tap into. Any advice appreciated!

You can use the regular Twitter api to search for Tweets containing your keyword. All docs are at dev.twitter.com. In the results set that you get back, you can also get the bio of each user. You could make a subselection in that text. We found the easiest way to load the results into a SOLR instance, and search on anything you want.

Related

How do I search tweets of a given multiple users based on certain criteria using twitter api?

I have list of users
['foo','bar']
I want to search whether they have checked in somewhere or not (using 4sq api)..
So basically, all I am looking for is that whether their tweets contain "\4sq.com\" or not?
I get very confused looking into their api?
Bonus points if the steps can be implemented in python.
Thanks
You have two options for checking a user's tweets:
One option is to look through the tweets in their User Timeline (accessible in Tweepy through api.user_timeline). However, you may have to search through a lot of unrelated Tweets before you come across the one your looking for. Given how many tweets some users have, you might want to only look thorough tweets more recent than a certain date (you can look at the created_at attribute of returned tweets).
The other option is to use the Search API (accessible in Tweepy though 'api.search'). This has the advantage of allowing you specify a search query, giving you relevant tweets. However, you will need to search through the tweets until you find one by the user you're looking for. Again, you might want to limit the date range of tweets that you search through.

Is there a way to get a list of users based on a hashtag they used?

I want to get a list of users who have used a particular hashtag. Eg. #ManOfSteel.
How can I get a list of the users who are using that hashtag as well as their details (like which city they are tweeting from) using a twitter API or any other means?
Yes, you can. And it's quite simple, really.
According to the documentation:
GET search/tweets: - Returns a collection of relevant Tweets matching a specified query.
Resource URL: https://api.twitter.com/1.1/search/tweets.json
Now if you scroll down on that page, it gives an example of what a query for a tweet returns (I took a screen, sorry about the appalling arrow, it's 10am here and I haven't had my tea yet).
Great! So you know the URL and method (GET) that you need to get your data. As for searching for a hashtag specifically, the query documentation is what you're after.
This is basically as urlencoded string in the GET request like: ?q=#hashtag. Perform the search like that and you'll get back the data above. Then just loop through it, find the user object, and grab the value location key if you want the user's city.
Now, as for a library to interact with the twitter API, you haven't even stated what language you're using. From your profile, you use JAVA I'm guessing. Regardless, checkout the libraries page on the twitter dev site - there's one for JAVA that looks pretty good (and many for other languages too).
If you were using php, this post would be immensely helpful.

Show tweets from people I'm following on website embedded Twitter feed

I've had a look at the following link - https://dev.twitter.com/docs/embedded-timelines within Twitter. It says you can display your timeline, favorites, lists but not the tweets from the people you're following.
Essentially when you first log into Twitter, I want to show those tweets - the tweets from people I'm following on my website.
Or is there a way to automatically add people we're following to a list? So I can then display that list?
Can it be done? If so, how?
I don't think you can achieve this with embedded timelines but you can achieve it by using the REST API. The link below gives details on how to do this. Your request will then return a json string of the latest tweets of people you follow. You can format this then display it
https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline

Twitter messages on website with votes

I am not sure how it is done, therefore my questions below:
I would like to ask folks on Twitter for a suggestion on a particular topic. Can I tell them to use certain hashtag and have all comments with that hashtag posted on my site?
Do I just pick a hashtag or does it need to be created somehow?
Can I have users on my site rate those suggestions? In that case, would I need to somehow grab twitter message and store locally?
Just trying to understand the process in order to implement it.
Hashtags don't have to be created - just use it in tweet.
In order to get all tweets with particular hashtag, use search API: https://dev.twitter.com/docs/api/1/get/search and search for this hashtag. You should save all relevant tweets (twitter search is not reliable on old tweets).

Twitter media search

Is it possible to search through Twitter's media for specific tags?
I know you can access the media via this url:
https://twitter.com/#!/therealpaddock/media/grid
Appending media/grid to the end of a user's ID, I was wondering if there is a way to search through all the twitter media photos via a tag???
https://dev.twitter.com/docs/streaming-api/user-streams
http://dev.twitpic.com/docs/
I have been searching through the API and googling, and I can't find anything out there that does this.
I have been looking at Twitpic's API but can't seem to find anywhere that lets you search and display images.
Tag? I'm not sure you understand Twitter. A photo is simply attached to a tweet. A tweet may have a hashtag. If you want to search by hashtags, simply use the normal tweet search, then filter the photos.
Not sure why you linked to Twitpic, as what you're looking for is the normal Twitter search. https://dev.twitter.com/docs/api/1/get/search
You can look at the Twicsy API.
It allows you to search all Twitter pictures using a search term (which is what I think you mean by tag).
http://api.twicsy.com/search/foo
http://api.twicsy.com/search?q=foo
They also provide ways to filter results, by number of results and date. (Go to the API docs for more details).
Another solution would be to use the Twitter search API to make the query and parse out the images manually. This blog post explains how.

Resources