简体   繁体   中英

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. Then 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM