0

Getting json return from twitter

I have a query:
CODE
select * from json where url="http://search.twitter.com/search.json?q=css" and itemPath = "results"


View in console here

It keeps returning Invalid JSON document as the error but when I visit http://search.twitter.com/search.json?q=css it downloads the json file fine? Am I doing the yql syntax incorrectly?

Similar issue with google search api going here returns the json fine but doing it in the console here doesn't return anything not even an error?

by
5 Replies
  • The query for google search api that works is
    QUOTE
    select * from json where url='http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=css' and itemPath='json.responseData.results'


    The only change was the itemPath which needs to include the root => json since thats added by YQL.
    The twitter issue is different in that twitter seems to be limiting YQL by returning a 200 OK with a response body containing a 500 error. This issue is being discussed in another message in the forum

    Hope that helps!

    -- Nagesh


    QUOTE (thecssninja @ May 14 2009, 06:14 PM) <{POST_SNAPBACK}>
    I have a query:
    CODE
    select * from json where url="http://search.twitter.com/search.json?q=css" and itemPath = "results"


    View in console here

    It keeps returning Invalid JSON document as the error but when I visit http://search.twitter.com/search.json?q=css it downloads the json file fine? Am I doing the yql syntax incorrectly?

    Similar issue with google search api going here returns the json fine but doing it in the console here doesn't return anything not even an error?
    0
  • What type of itemPath do I need for JSON returned that looks like this:

    {
    "resultCount":100,
    "results": [
    {"wrapperType":"track", "kind":"song",......
    <snip>

    I've tried json.results, json.results.wrapperType, just json, nothing... each time I get an "Invalid JSON" message. Anyhelp will be appreciated! :(-- Nagesh
    0
  • From looking into this further I have found that Yahoo Pipes reads the JSON ok - why won't YQL?

    My table definition is here :
    http://www.sladefarm.com/table/itunes.xml
    0
  • QUOTE (steven_barker@... @ Aug 24 2009, 01:45 AM) <{POST_SNAPBACK}>
    From looking into this further I have found that Yahoo Pipes reads the JSON ok - why won't YQL?

    My table definition is here :
    http://www.sladefarm.com/table/itunes.xml


    It looks like the web service you access in the table returns json, but with a large amount of whitespace before it (which isn't correct). We'll take a look to see if we can strip it prior to parsing.

    Jonathan
    0
  • Thanks for your response Jonathan. Can this be done now in the <execute> statement?


    QUOTE (Jonathan @ Aug 25 2009, 01:30 PM) <{POST_SNAPBACK}>
    It looks like the web service you access in the table returns json, but with a large amount of whitespace before it (which isn't correct). We'll take a look to see if we can strip it prior to parsing.

    Jonathan
    0
  • Recent Posts

    in YQL