Christian Heilmann

Posts Tagged ‘wrapper’

Retrieve and display Flickr photos the easy way with getFlickrBy

Saturday, May 9th, 2009

As part of my talk on YQL for Open Hack London I’ve thought of an easy way to get Flickr photos that you are allowed to display in your products and hacks.

The wrapper API getFlickrBy works around the somewhat convoluted data returned from Flickr’s API methods and uses YQL to cut the information you want down to the bare necessities. Furthermore the API only returns photos that are licenced with Creative Commons’ “By” license to avoid you using photos you have no right to use (which is a big thing with the Flickr crowd).

The API endpoint is:

http://isithackday.com/api/getFlickrBy.php

You have several parameters to play with:

location
The location you want photos of as defined in the Yahoo Geo API
search
A word you want to search for
format
The format of the returned data, XML, HTML or JSON - preset is XML
callback
A name of a JavaScript function call to wrap the JSON data in, in case you want to use the API in a script node
amount
The amount of photos returned, max is 100 – preset is 20
size
the photo size, “s” for 75×75px, “t” for thumbnail, “m” for medium, omit to get big size

The API returns only what you need: the image title, the owner, the url of the image and the link to Flickr. If you use html as the output format it returns an HTML list of linked images. For output demos and explanations simply call the API without any parameters

Here are some examples how to use the API:

Making Yahoo BOSS easier with yboss

Monday, November 10th, 2008

Having had a lot of hackers at the Open Hack Day Brazil get confused on how to use the JavaScript output of Yahoo’s Open Search platform BOSS I’ve spent a short while to write a wrapper library for it. You can now easily search the web, images and news of Yahoo in one go with a few lines of code:



The wrapper does all the work for you: creating the different script nodes calling the BOSS API with the right parameters and either returning a JSON object with all the mandatory search data (links in a certain format) or returning a bunch of HTML lists that can be printed out as innerHTML anywhere you like.

Check out the yboss homepage and download the script for yourself. The hackers at the Hack Day loved it and the winning hack in the BOSS category was based on it. Also check out the presentation I’ve given on BOSS at the hack day to learn all about the system itself:

[slideshare id=733718&doc=javascript-and-boss-open-hack-day-brazil-2907&w=425]