How do you track youtube views or facebook likes in "real time" so that you know which video or content is being viewed alot? (not your own content)
Using code on a server. You'd have to use their API to access the data. Be aware of how many items you're tracking though because you will run into rate limits. It's likely going to be impossible to gather statistics for all the videos out there, but you certainly can monitor quite a few.
However, you should be aware that the "real time" factor isn't always going to be possible. Many of these services don't update the counts for views, likes, etc. that often. In my experience, it's been about every 15 minutes depending on the site (some quicker, some slower).
That's ok too, because since you don't need to access their data every few seconds for that "real time" factor, you don't run into as many rate limit issues.
I've built an algorithm and tool to rank popularity or virality here:
It obviously doesn't go out and get everything and I'm not looking at YouTube videos (though I could and have in the past)...But it does a real great job at surveying current events. From that, a really nice index was created which can be used to measure the virality of any other content on the web.
For YouTube specifically, you may want to look at Unruly's viral video chart: http://viralvideochart.unrulymedia.com/all
If number of views is all you're after, that should work...But virality is much more than that.