Yahoo API Wrapper

To be honest I don’t like Yahoo Search ActionScript 3.0 API, it doesn’t support all data types, for example in order to get thumbnail url, from image search request, you have to parse xml manualy… Also it does not compile with strict-mode compiler option.

So I’ve decided to create my own wrapper for Yahoo API. Here is another pre alpha version (damn, I have too many alphas :) ).

My wrapper has new event object - YahooEvent, and different ValueObjects for different search types. for example Web VO has following fields:

  • title
  • summary
  • url
  • clickURL
  • dateModified
  • cache:
    • url
    • size


And image search request will return collection of Images:

  • title
  • summary
  • url
  • clickURL
  • fileType
  • fileSize
  • thumbnail:
    • url
    • width
    • height

I will add more VO’s for news, context and other searching types soon.

And by the way I’ve added MXML support, so you can use YahooSearch directly from MXML just like this:



	

	
	
		
		
	
	

API does not documented yet nor finished, but I’m working on it :D.

.Download version 0.0.0.0.0.0.1

7 Responses to “Yahoo API Wrapper”

  1. _sevenDust Says:

    Hi, link is invalid. Found it under http://orangeflash.eu/wp-content/ysas3api.zip though

  2. Nirth Says:

    Oops, I’ve moved file and forgot to modify link,

    http://lab.orangeflash.eu/flex2/webapis/YSAS3API.zip

  3. mr datsun Says:

    Hi,
    Excellent. You’re the only person on the whole internet who has done this. You’ve actually made the Yahoo search API useable.

    Am I the only person who finds the yahoo AS3 API and documentation totally incomprehensible? I wonder if that’s why only two people have posted yahoo/flash examples on their site since it was first released?

    I used to call a simple yahoo url to get image search results xml that i could parse easily in AS2 days. A shame that stopped working in AS3.

    many thanks.

  4. mr datsun Says:

    can I ask - what is the right way of getting the results back after the search is finished? I’m not sure what the YahooEvent is doing. I’ve tried adding an YahooSearchResultEvent listener to my Yahoo instance but it doesn’t work and I’m just guessing.

    I’m thinking of hacking a callback for now but I’d like to know the most elegant way of doing it, please.

  5. Nirth Says:

    Hey
    eu.orangeflash.webapis.yahoo.Yahoo has event - “result”, you need to do following:
    myYahooInstance.addEventListener(YahooEvent.RESULT, onYahooResult);

  6. mr datsun Says:

    Thanks!

  7. mr datsun Says:

    Feedback

    I could not get your wrapper to work on line. I don’t understand the intricacies but flash failed to load a yahoo crossdomain.xml.

    The sad fact is that yahoo have totally changed the API since you wrote your lovely wrapper.

    I dug into the new API and found that if I used this code:

    var searchService:SearchService = new SearchService();
    var searchParams:SearchParams = new SearchParams();
    searchService.addEventListener(SearchResultEvent.RESULT, returnResult);
    searchParams.query = e.target.myterm;//my search string from a button mouse event
    searchService.searchImages(searchParams);

    //this last line is the line I changed from their example (searchImages not searchWeb)
    //and I did this rather than find out how to send a image SearchService setting type into their API

    Once I did this then all the code I used for your wrapper in the returnResult method worked exactly the same - the images loaded straight off and it also worked online.

    Another note is that a yahoo appID seems to be no longer needed to authenticate the search.

    Many thanks for you help and hope my feedback is some use to you or others.