-1

I want to make a webrequest to e.g. http://finance.yahoo.com/q?s=rb.l and extract the share price. However the text returned is before the browser has processed it and I need it processed first before the <span></span> element exists that I need to look for.

Is this possible, or should I be looking at doing it another way?

Similarly any reliable 15-min delayed free stock service for the LSE or other way of obtaining this data given just the ticker code would be great.

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
  • 1
    How does the `WebRequest` class relate to an actual browser? – Matthew Apr 01 '13 at 19:41
  • 1
    By "process" do you mean "execute JavaScript"? If so, then no. What you're talking about is a web browser, which does a _lot_ more than make simple HTTP requests (which is what a webrequest does). – David Apr 01 '13 at 19:42
  • is this a local (winforms/wpf) app or a web app? – shaish Apr 01 '13 at 19:45
  • 1
    Are you sure that the screen scraping you're attempting to do doesn't violate Yahoo's terms of service? – StriplingWarrior Apr 01 '13 at 19:47
  • Yes I mean execute all the client side code, I'm doing this until I can find another way to get stock prices. I'm not sure about the Yahoo ToS I will check – Jennifer Anderton Apr 01 '13 at 20:15

1 Answers1

1

There are two questions here: first, how to programmatically access data on a page after allowing javascripts and such to run on that page as if it were being read by a real browser. Secondly, how to get stock ticker information programmatically.

To answer the first question: You could use something like WebDriver .NET to literally instantiate a browser that opens the page, and then access elements on the page.

To answer the second question, I suggest you try to search for that question directly, since it's a common enough problem that you'll probably find a number of people who have answered it already.

Community
  • 1
  • 1
StriplingWarrior
  • 151,543
  • 27
  • 246
  • 315
  • Thanks - yes I didn't really mean to add the 'second' question that was really just putting it in context. I will look at WebDriver to see if this will work and post back – Jennifer Anderton Apr 01 '13 at 20:17