Twitter streaming seems to have a latency of one tweet always - twitter

There seems to be a latency of one tweet when streaming from twitter.
Scenario
Start the streaming with a track parameter, say "oopsnotworking"
Tweet a tweet containing the "oopsnotworking"
The stream does not seem to pick it up
Tweet another tweet containing the "oopsnotworking"
The stream now picks up the first tweet
continue
This seems to happen to be for over a week, since I started working on streaming API. At first I thought the API is having a issue during that time, but I have heard that any issues with the API seem to get resolved within hours.
So is this how it is supposed to work?
I am using Twython btw.

I was able to get rid of the latency. Let me answer it myself.
There seems to be some problem with Twython, I did not look up the internals but I am pretty sure it is with Twython because when I started using Tweepy everything works fine.
I am guessing Twython is opening multiple connection caused a bottleneck, once again I haven't looked up the internal so I am not really sure what is going on with Twython.

Related

Youtube API search livestream stop to work

A few days that the youtube api stop to show a livestream videos, is this error only on my api key? if does, is there any other way to find a livestream videos?
I googled if there any message from youtube about this, and i didn't find.
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UC4R8DWoMoI7CAwX8_LjQHig&eventType=live&type=video&key={MY_API_KEY}
You are not alone.
It's broken for everybody, unfortunately, and it's been this way for over ten days now. As with all Google services, human support and feedback is non-existent, not even an acknowledgement of the issue.
Ref.: https://support.google.com/youtube/thread/14611425
As a workaround, I had to change the logic to use the q parameter along with eventType=live. This actually works, and, depending on keywords, can also return a whole lot of unrelated live material, which, I think, can be further filtered on the client. This also seems to incur higher quota usage.
Well, I guess the issue is you try to use a meta-channel. UC4R8DWoMoI7CAwX8_LjQHig refers to what you get when you click on live in the menu, but this only "sums up" what's live, it isn't a real channel itself. Just strip the channelId parameter you should get all active live streams (only tested at reference page https://developers.google.com/youtube/v3/docs/search/list but got me 14.5k at time of try).
Matt

How twitter updates retweets and favorites without refreshing the page

Does anyone who use the current version of twitter right now know what they used to update retweets and favorites without having the user refresh the page? Or does anyone at least know how i can do this with swift? Would think be possibly by using ajax on the backend?
There are a couple of ways to get that working. You can run an script that every second hits an url and gets the new retweets and stats, and updates the info on the page.
There is something about a relatively new technology called WebRTC, that provides a different way to connect two devices through the web (RTC stands for Real Time Communication).
Of course, you can use some ready plugins, or maybe some frameworks that are proper to do that work, with no pain, but the ideal is that you know how these things works under the hood first.
I hope I've helped.

twitter api 1.1 url count alternative

I've been using the old url api(v1) to get the count of a given url, lately I needed to get also the re-tweets and started searching about that.
this is the exact url I'm using right now:
http://urls.api.twitter.com/1/urls/count.json?url=http://google.com
As I viewed with some reading the v1 api is deprecated but at least it's still working.
I found some questions on the dev page of twitter:
https://dev.twitter.com/discussions/12643
those are a little old questions and have no specific solving to the problem. I mean, the most near solution was using the search api(search/tweets) which could be good but not a exactly replacement for the urls/count method.
Please note that Twitter's search service and, by extension, the
Search API is not meant to be an exhaustive source of Tweets. Not all
Tweets will be indexed or made available via the search interface.
also it has a limit for 100 results at maximum per 'page', even it throws the link to get the next set of objects, thats good but when the search reaches 1 million of results I'll need to get page over page to now how much tweets I got and having to do to much request to the api...
I sought some question over the dev page on twitter suggested using the stream api, I've tried using (statuses/filter) but that don't work very well given a URL as track param(which they said that is the keyword to track).
So, anyone who's been using the old urls/count has found a reliable alternative with the new apiv1.1, especiffically to get the tweets and re-tweets for a given url ?
The official suggestion by Twitter staff is that either the search/tweets endpoint (having just the last 7 days data) or the Streaming API be used (handling yourself the counters, making everything just too complicated for a d*mn counter).
As an extra warning, the old endpoint (http://urls.api.twitter.com/1/urls/count.json?url=YOUR_URL) will stop working on November 20th, and according to this blog post from Twitter there are no plans to replace it with anything in the short term and they are even removing the count from their own buttons.

How does the "Sneak peak" Twitter account work?

So I came across this Twitter account while I was wasting time on Failblog. I became very intrigued by it. The way it works is this person tweets 'I think you mean "sneak peek"' whenever someone tweets something with the string "sneak peak" in it. And it is automated as I discovered by tweeting "Sneak peak" myself, and getting a response within seconds:
So my question is, how is this done?
Can you get notifications somehow when someone tweets something containing a certain string? Consider that this already happens when someone tweets your username, so it is technically possible.
Or does this person have a computer running all the time that searches twitter every few seconds for the string?
Or are both possible?
This almost certainly uses the Twitter Streaming API.
The set of streaming APIs offered by Twitter give developers low latency access to Twitter's global stream of Tweet data. A proper implementation of a streaming client will be pushed messages indicating Tweets and other events have occurred, without any of the overhead associated with polling a REST endpoint.
So, there is a server somewhere which is continually streaming the Twitter API, filtered for the specific term.
Whenever the server sees a new tweet come through the stream, it tweets the response automatically.
So, to answer your questions:
1) Yes.
2) Yes, but it's not constantly polling, it's receiving the data automatically.
Not sure about 1), but 2) is easily manageable using the search API :
http://search.twitter.com/search.atom?q=sneak%20peak will get you the recent tweets containing 'sneak peak'. (including the time of the tweet)
Then the program can answer to those people, and keeping the time of the tweet in order to not tweet to people which the program has already tweeted to.

Track multiple search terms with twitter streaming

I would like to build a web application that tracks some user defined search terms in real-time and provides a real-time visualization. http://www.monitter.com/ is an app I've found that is similar in its requirements. What is the appropriate API to use for it? Initially I thought the streaming API was the obvious choice, but the limitation of one concurrent connection means that I can only track one search term at a time(with one user account). I could get around this by making multiple user accounts, but that seems like the wrong approach.
I looked at user streams but the language for that API seems to be more geared towards desktop applications.
So, what is the most best API for my use case? Thanks.
Actually you can track up to 400 keywords/terms via one streaming API connection.
https://dev.twitter.com/docs/streaming-api/methods#track
Depending on language you are using there are multiple interfaces you can use.
If you are using PHP, then I can suggest Phirehose as it works quite well and has multiple examples for different usages scenarios included.
http://code.google.com/p/phirehose/wiki/Introduction
Whats not there - when processing received tweets you will need to figure out how to match which tweet corresponds to which keyword/term because twitter streaming API gives all matching tweets in one stream.
Investigating further using Firebug, I found that monitter.com simply polls the REST search api every second or so on the client side. This is what I ended up doing as well.

Resources