vbs/html yahoo finance streaming quote

- / -
June 1, 2009 at 22:31:38
Specs: XP, P4 & 1GB
i am trying to get stock quote from yahoo fnance, using internetexplorer object. i try to cut the unneeded html code, and get the table only.
i've the following code, it modified the html to only show table, but the problem is the streaming quote/ticker is not updating.

url = "http://finance.yahoo.com/intlindices?e=asia"
'url = "http://finance.yahoo.com/indices?e=dow_jones"
set ie=wscript.createobject("internetexplorer.application")
if wsh.arguments.count=0 then ie.statusbar=1 else ie.statusbar=0
ie.Visible = true

ie.navigate2 url
while ie.readystate<>4 : wsh.sleep 100 : wend 

for each s in split(html,vbcrlf)
	'get the javascript coding part located at top
	if instr(s,"<DIV id=ygma>")<>0 then write=false		'line 12
	'get html code for index ticker table
	if instr(s,"<DIV id=yficc>")<>0 then write=true		'line 114
	if instr(s,"<DIV id=th>")<>0 then write=false		'line 187

	'get the javascript coding part located at bottom
	if instr(s,"Copyright/IP Policy")<>0 then 
		write=true:s="<TABLE><TBODY><TR>"&s		'line 229
	end if
	if instr(s,"Quotes delayed")<>0 then s=""		'remove line 258

	if write=true then newhtml=newhtml&s&vbcrlf

if wsh.arguments.count=0 then ie.document.body.innerhtml=newhtml
set ie=nothing

cscript//nologo test.vbs -- this one not work
cscript//nologo test.vbs dontcut - this one works

any idea what's wrong? i think it's something to do with the html coding, but my knowledge in html is minimal. can i anyone take a look into this.

my purpose is to get the html that display the ticker table only with streaming code 'on'.
i also have tried to save the page as html then edit the htm file manually.

See More: vbs/html yahoo finance streaming quote

Report •

June 1, 2009 at 23:28:59
hmm interesting reno, sorry i cant help with it as you are with my Questions. but non less interesting what you want to do.

i like it.

Report •

June 3, 2009 at 13:27:10
This line will either destroy the page's javascript, or it's causing the script(s) to bomb. That's why it doesn't auto-update.

Report •

June 5, 2009 at 00:56:34
i guess so, the javascript got messed up.
even without stripping the html code, just reassigning the str to innerhtml mess up the auto-update

is there any way to workaround this?
i can't keep reloading the page and parse the value, as my connection pipe is small.

i also tried to relieve the bandwith to another server using asp, works on first try, it load the page, but later cause server internal error. and i dont have the chance to parse the page content to only get the numbers i need.

	dim url
'	url="http://finance.yahoo.com/intlindices?e=asia"
	dim xmlhttp 
	set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
	xmlhttp.Open "GET",url,false
response.write readystate & "<br>"
	response.write xmlhttp.responsexml
	response.write xmlhttp.responsestream
	set xmlhttp = nothing

my purpose is to display the running-index in a small no-scroll window using minimal bandwith. any idea?

Report •

Related Solutions

June 13, 2009 at 20:49:19
Something like wget might be able to pull only the HTML text document, in which case it becomes a simple text parsing problem

Report •

Ask Question