How to get results with twitter search api? - twitter

I wish to get tweets with a keyword. But There is no result with any keyword.
http://search.twitter.com/search.json?q=summer
How to get results with Twitter Search API?

Version 1 of the twitter API has been deprecated and is being removed. Not sure how you can miss the giant warnings on the twitter dev site ;) This means simple code like the above will not work any more.
So, you now need to make authenticated requests (OAuth) using the 1.1 API, and it's nowhere near as simple as just doing a (in PHP) file_get_contents(http://search.twitter.com/ ...).
I couldn't see any server-side languages you use from your profile, but I wrote a lengthy post explaining the issue (with pictures) and how to use a php library to perform authenticated requests.

Related

Issues With Twitter API V2 Elevated Access and has:geo Query Parameter

I have Elevated access to the Twitter API V2, and I am working with the API in Postman to search for recent Tweets containing a keyword. I’d like to be able to add a further query parameter to only return Tweets that have a geolocation associated with them. To do this, I am adding the has:geo parameter, as shown in the below URL call:
https://api.twitter.com/2/tweets/search/recent?query=dogs lang:en -is:retweet has:geo
However, this is returning with the following error:
There were errors processing your request: Reference to invalid operator 'has:geo'. Operator is not available in current product or product packaging. Please refer to complete available operator list at https://developer.twitter.com/en/docs/twitter-api/enterprise/rules-and-filtering/operators-by-product.
From my understanding, of this page in the documentation, the has:geo search operator is only available to accounts with Elevated Access to the V2 API (which I have).
If anyone has any suggestions of how I can get around this issue, that would be much appreciated please.
If you check the detail on that page, it further explains:
Twitter API v2
- **Essential**: Available when using any Project
- **Elevated**: Available when using a Project with *Academic Research access*
I agree that it is not sufficiently clear on that page, unless you re-read it (because "Elevated" and "Academic Research" are technically different access levels for your account).
The answer is that in order to use that search operator, you would need to have Academic Research access, not just Elevated access.

Use Tweepy to extract Twitter follower information (API incompatibility issues)?

I was following this tutorial, https://towardsdatascience.com/how-to-download-twitter-friends-or-followers-for-free-b9d5ac23812, which was written in 2021. It should've worked fine, however, they have to 'fix' the things that just work.
Specifically, running this line
for fid in Cursor(api.followers_ids, screen_name=screen_name, count=5000).items():
ids.append(fid)
gives the error:
"tweepy.error.TweepError: [{'message': 'You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve', 'code': 453}]"
I could have pulled the data in five minutes. Now debugging this already cost one hour+ because they just break the things that work. Is there anyway to make this old code snippet work? The application to use API 1.1 takes weeks, and I don't have time to watch their bad documents of how to migrate from API 1.1 to 2.0 and then the documents of migrating from Tweepy 3.9.0 to 4.0.0. Five minutes' task would just become half a day. Thanks in advance for any help.
First of all, have you at least tried to apply for the Elevated access?
It can take some time, it's true, but it can also be instantaneous.
The other solution would be to use the Twitter API V2.
You don't need any tutorial, just read the documentation:
Here for the authentication ;
Here for the retrieval of the followers ;
Here for the pagination.
And you should get something like that:
import tweepy
client = tweepy.Client("Bearer Token here")
paginator = tweepy.Paginator(
client.get_users_followers,
id=..., # ID only, no screename
max_results=1000
).flatten()
for follower in paginator:
print(follower.id)
Finally, even if I understand your frustration (and developing Twitter applications can be very frustrating), I think that you should try to keep it out your SO questions. Good luck!

How to use Twitter User Streams

I am new in Twitter API. I have a requirement like I have to pull the information of an authenticated twitter user to know the number of followers. I can do this using REST API but I have a problem here. So I have taken the way to use Twitter User Streams.
I am not able to integrate this functionality in the site. I am using twitter console( https://dev.twitter.com/console ). But there I am not able to get any kind of result, it actually hangs/shows gateway timeout. And that's for I am not able to configure that how to write the code for this or how to use this in site. I am not passing any kind of parameters.
So, any body can please help in this would be very grateful( a clean sample code for this or any link where to get the good documentation ). I have already checked with twitter dev documentations.
Thanks in advance :)

BlackBerry 10 Twitter Integration

I would like to integrate Twitter into my BlackBerry 10 application so that I can post, get, favorite and retweet messages from Twitter. Native BlackBerry.
Try searching on github - there are several sample twitter projects on there:
Github search results
For example: BB10 Sample Twitter App
At the moment, BB10 platform offers built-in invocation requests for a core Twitter app, however, these requests are pretty limited in functionality - you can only share content with different URI, but not get, favourite, retweet message and so on.
If there's another application which can handle these type of requests, you may use unbound (or bound) requests for you needs, but in order to do that you have to know Action attribute (and TargetID in case of bound invocations) value.
Here is a link explaining mechanism of invocation sending as well as bound and unbound requests - https://developer.blackberry.com/cascades/documentation/device_platform/invocation/sending_invocation.html

Twitter tweets about a certain url via salmon and/or pubsubhubbub?

For a web-application I am writing (Rails) I am looking for ways to post back publick mentions about that post. Mentions on Twitter, Facebook, Reddit and so on.
Starting with Twitter, I am looking for a way to get these tweets back into the application. Obviously I could simply monitor the twitter firehose (through their search, most probably) for a certain url (the url of the post), if found, extract that and place that tweet as new comment to the post. But this requires me to invent something similar for each and every social network.
Whereas there is a generic protocol for this: Salmon, allowing services to push such comments (tweets mentioning your url) through PubSubHubbub (PSH).
I did not find any mention of this on the Twitter API itself; they are not using PSH or Salmon (yet) it seems.
But maybe there are thirdpartis that do? Know any? Are there other projects that wrap around Twitters firehose and allow you to approach Twitter as if it is a Salmon-speaking pubsubhubbub? And What about Reddit, or Facebook?
The Twitter API TOS explicitly forbids the re-distribution of tweets via APIs*, except for Twitter's partners. These are DataSift and Gnip - but they don't do what you are looking for.
Your best option would be to simply monitor the filterhose.
* Actually, it's allowed to share IDs, but those are pretty useless since you have to look them up manually.

Resources