Extract real time data from ajax website in python
I would like to extract real time data from a webpage: http://www.fxstreet.com/rates-charts/forex-rates/
I am programming in Python and I did an urlopen to take the htmlcode. Th开发者_JS百科en I used regular expressions to extract the numbers. Problem is that I have to do an urlopen each second to get the latest data, its long not reliable and not clean... Can someone help without having to refresh the webpage? thanks!
Here's something to get you going. Try the following from the command line:
curl -d '[{"channel":"/meta/connect","connectionType":"xhr-streaming","id":"15","clientId":"14799ac3-a0ac-43ab-8bb6-baad56886e11"}]' "http://ttpush.fxstreet.com/http_push/connect"
As you can see, as long as you keep the connection open, the site keeps pushing more data to you. I would think that would be easy to convert to Python.
精彩评论