How to exclude screenname in twitter search api - twitter

Im using twitter search api https://dev.twitter.com/docs/api/1.1/get/search/tweets to fetch popular tweets and the result contains #screenname #hashtag and links....., so how to construct api to return tweets without #screenname? and I tried to use "-filter:screenname" to exclude, but its not working.
Thanks.

Have you tried "-from:screename"?

Related

Geocode in Twitter API doesn't work

Can somebody tell me about Twitter Search API with geolocation filter?
I'm trying to use
GET https://api.twitter.com/1.1/search/tweets.json?oauth_consumer_key=*************&oauth_token=************-**********************&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1502873578&oauth_nonce=*****&oauth_version=1.0&oauth_signature=%****************%3D&q=ffdp&geocode=45.458626,9.181872999999996,150mi
45.458626,9.181872999999996 - Milan, Italy
And I have no statuses, but if I try this query, using advanced search:
https://twitter.com/search?l=&q=ffdp%20near%3A%22Milan%2C%20Lombardy%22%20within%3A15mi&src=typd&lang=en
I have some statuses.
Can somebody describe me, please, does it work? Or, maybe there are some mistake in my request?
The link for your advanced search returns tweets that are much older than a week. In general, very few tweets have latitude and longitude embedded with them. Also, the Twitter Search API will only return tweets from the past week or so. For both these reasons you are not seeing any tweets from Milan.
Try setting up your retrieval parameters like this
["geocode" => "Lon,Lat,Radius"]
for example
["geocode" => "37.781157,-122.398720,1mi"]

Dailymotion API fulltext search : exclude keywords

Is there a way to search videos and exclude a list of keywords?
I tried to exclude terms through the API by passing the search foo -bar :
https://api.dailymotion.com/videos?search=foo+-bar
But the response contains video that matches both foo and bar.
The behaviour seems to be the same on the website's main search bar.
no, unfortunately Dailymotion doesn't offer a way to search for videos by exclude a list of keywords, -bar won't work on the API nor on the webbsite.
What you can do though is to filter reponses on your side after you get them through the api.

Is there a way to use since_id and max_id in Twitter's Search API?

I'm trying to get the search results between two specific id's but it seems to ignore the ids, here is a sample of my query:
http://search.twitter.com/search.json?since_id=58308825907871744&q=%23twitter&rpp=100&max_id=58309448581660674
It just throws back the same set of results if I change the ids. Any ideas?
Unfortunately, the search API doesn't support a max_id parameter. It features an until parameter instead, which is specified as a date rather than a status ID. So, you would have to reformat your query something like the following:
http://search.twitter.com/search.json?since_id=58308825907871744&q=%23twitter&rpp=100&until=2011-04-14
Twitter API issue 2052 details Twitter's response to the very issue that you raise.
Note that in v1.1 max_id is supported on the search api.
https://dev.twitter.com/rest/reference/get/search/tweets#api-param-max_id

Twitter: Number of tweets OR get more tweets

I would like to know how can I get all tweets from a certain hash tag?
I am currently using the following code:
xhr.open("GET","http://search.twitter.com/search.json?q=%23PrayForJapan");
This only returns me 15 tweets. Does anyone know how to make it return more?
Also, I have got a code to get me the tweets of a certain screen name, this only returns 20 tweets, how can i ask the following 20 tweets?
The code i used for that is:
xhr.open("GET","http://api.twitter.com/1/statuses/user_timeline.json?screen_name=Eminem");
I'm using titanium to create this, but I don't think that is an issue?
Thanks!
You can usually add count=x as parameter to the query string to get up to x tweets (for the search api it seems to be rpp). Query string parameters are added to the base url via ? and each individual parameter is then separated by & as in http://api?user=1&count=4
Most of the time, it is better though to remember the last tweets and then add ?since_id=x as this way you only get tweets you did not see before.
Have a look at the api documentation.

Twitter API - Display all tweets with a certain hashtag?

How would I go about displaying tweets that contain a certain hashtag using the Twitter API? Thanks
I'd also like to know if there is a way to get all tweets from a certain hashtag in a separate file, also the ones that don't show up in your feed anymore. I suppose that's what the earlier question was about, too.
This answer was written in 2010. The API it uses has since been retired. It is kept for historical interest only.
Search for it.
Make sure include_entities is set to true to get hashtag results. See Tweet Entities
Returns 5 mixed results with Twitter.com user IDs plus entities for the term "blue angels":
GET http://search.twitter.com/search.json?q=blue%20angels&rpp=5&include_entities=true&with_twitter_user_id=true&result_type=mixed
UPDATE for v1.1:
Rather than giving q="search_string" give it q="hashtag" in URL encoded form to return results with HASHTAG ONLY. So your query would become:
GET https://api.twitter.com/1.1/search/tweets.json?q=%23freebandnames
%23 is URL encoded form of #. Try the link out in your browser and it should work.
You can optimize the query by adding since_id and max_id parameters detailed here. Hope this helps !
Note: Search API is now a OAUTH authenticated call, so please include your access_tokens to the above call
Updated
Twitter Search doc link:
https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html
The answer here worked better for me as it isolates the search on the hashtag, not just returning results that contain the search string. In the answer above you would still need to parse the JSON response to see if the entities.hashtags array is not empty.

Resources