Yahoo! Search monkey API - CEBIT 2008

  • Published on
    16-Apr-2017

  • View
    2.039

  • Download
    2

Transcript

Starting to Monkey AroundStarting to Monkey Around With Yahoo! Search MonkeyYoull never make a monkey out of meCEBIT Turkey 2008 ric DaspetOriginal presentation by Neil Crosby (One of Yahoo!s Monkeys in London)Who Am I ?Frontend engineer at Yahoo!but not in the Search Monkey teamWhat is Search Monkey?A way to create more interesting Search Results.Enhanced results and Infobar.Enhanced results fit a tight template, infobars can be far more freeform.Some Normal Search ResultsMonkey Monkey Monkey!Where does the data come from?MicroformatsRDFaOr pull it in from the page using XSLTMy First MonkeyStart with something containing microformats.FaceBooks public profile pages fit the bill.Well build a monkey that shows the users profile picture.Go to http://developer.search.yahoo.com/Starting your Monkey Basic InfoNameDescriptionCategory (for gallery)Icon (really important)Dont forget to agree to the T&CURLsUse auto-generate first.Then choose specific URL for first field.First URL is used to generate previews in gallery.Data ServicesWe can ignore this for now since were using formats that are built into Search Monkey.AppearanceThis is where well actually do some work.You must change something from the default here.Using the right hand rail+/- expands/contracts sections.Clicking an item pastes that data into your PHP at the cursor.Making our changes$ret['image']['src'] = Data::get('com.yahoo.uf.hcard/rel:Card/vcard:photo/@resource');And thats all there is to creating a simple monkey!Let others play with your monkeyOnce youre happy with your monkey, share it.Let users add your monkey to their SERPs.Share your source if you want to.Monkey 2: Robotic Monkey of DoomWe want a Flickr Monkey that:Shows main/first photo on a page.Includes relevant information about photo.No relevant formats on the page, so we need some XSLT.Will be slower than pre-spidered Formats.We need to create a data service.Creating the Data ServiceStarts the same as a Format Monkey does.Basic Info.URLs.Trigger: *.flickr.com/photos/*First test: http://www.flickr.com/photos/thevoicewithin/1276763134/Now for some XSLTScary, but not too scaryBe aware of allowable rel values see documentation.XSLT First PassWe want to extract an image URL and a description.Assume the only page type is the single photo page for now.Use Firebug and/or XPather in Firefox to work out XPaths to our required nodes. XSLT First PassSave & RefreshCheck that we dont get any errors.Then, back to the homepage.Making our Flickr MonkeyGive it a nameTrigger: *.flickr.com/photos/*First Test: http://www.flickr.com/photos/thevoicewithin/1276763134/Flickr Monkey Data ServicesAdd More Data ServicesBecause were using the same URL trigger for monkey and data source, the source shows up hereFlickr Monkey AppearancePoint and click info from the data source.$ret['summary'] = Data::get('smid:DATA_SRC_ID/rel:Photo/dc:description');$ret['image']['src'] = Data::get('smid:DATA_SRC_ID/rel:Photo/@resource');But Flickrs more complex than that!Flickr doesnt just have individual photo pages under *.flickr.com/photos/*Also has tag, user, set etc pages.We should handle this at our end, so users only have to add one monkey.Enter xsl:chooseAllows if-elseif-else statements in XSL. ... ... ...Heres one I made earlierhttp://gallery.search.yahoo.com/application?smid=w4q.s (source available)And were doneTheres lots more you can go away and do.We havent even looked at infobars.You can also fiddle with web services.Theres a whole world of opportunity.searchmonkey-developers@yahoogroups.comhttp://developer.search.yahoo.com/Thankyou.Any questions?These slides are available at:http://icanhaz.com/monkeys(redirects to http://www.slideshare.net/neilcrosby/starting-to-monkey-around-with-yahoo-search-monkey/ )03/07/08