Source: site.view [edit]
Function name: lookupYahooCategoryID
Arguments: cats
Description:
Page type: webl
Render function:  
Module: sandbox

Page source:

var getCategories = fun(search, location)

   var P = GetURL("http://api.local.yahoo.com/LocalSearchService/V3/localSearch",
   [. appid="wubhuboaa", sort="relevance", query=search, location=location,
      result=20 .]);

   var res = { };
   every c in Elem(P, "Category")  do
      res = res + {ToString(c.id) + " " + Str_Trim(Text(c))};
   end;
   return res;
end;

var res = "";
var i = 0;
every cat in Str_Split(cats, "\n") do
   i = i + 1;
   cat = Str_Trim(cat);
   if (cat != "") then
      res = res + cat;
      every c in getCategories(cat, "san francisco") do
         res = res + ", " + c;
      end;
      res = res + "\n"
   end
end;
res;