0

How do I access the text string returned by a YQL request?

Using the YQL console, I entered:

select * from htmlstring where url='finance.yahoo.com/q/op?s=PG'

And the display panel showed the raw html of the entire page as XML, which is what I wanted.

It gave me the REST Query at the bottom of the page as follows:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20htmlstring%20where%20url%3D'finance.yahoo.com%2Fq%2Fop%3Fs%3DPG'&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys

How can I put that url in a script (with or without jQuery) so that I get the same output in a string I can then parse?

I find nothing on the YQL pages that tells me how to do that, and all my attempts (with or without jQuery) have been unsuccessful.

The text I want is apparently somewhere in a returned object. How do I get at it?

by
1 Reply
  • You have to use $.getJSON if using jQuery,

    and the URL to query would be what you provided but with &format=json. So:

    <http://query.yahooapis.com/v1/public/yql?q=select%20>*%20from%20htmlstring%20where%20url%3D%27finance.yahoo.com%2Fq%2Fop%3Fs%3DPG%27&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&format=json
    
    0

Recent Posts

in YQL