Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: b9d7e44a1a
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (46 sloc) 2.034 kB
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<sampleQuery>select * from {table} where keyword="oil spill" and region="us" and lang="en"</sampleQuery>
<author>Christian Heilmann</author>
<documentationURL>http://keywordfinder.org</documentationURL>
<description>Returns the 20 best keywords for a certain term by analysing the top 20 results of Yahoo.</description>
</meta>
<bindings>
<select itemPath="" produces="JSON">
<inputs>
<key id='term' type='xs:string' paramType='variable' required="true" />
<key id='region' type='xs:string' paramType='variable' required="true" />
<key id='lang' type='xs:string' paramType='variable' required="true" />
</inputs>
<execute><![CDATA[
var res = y.query("select resultset_web.keyterms from json where url='http://boss.yahooapis.com/ysearch/web/v1/"+encodeURIComponent(term)+"?appid=TX6b4XHV34EnPXW0sYEr51hP1pn5O8KAGs.LQSXer1Z7RmmVrZouz5SvyXkWsVk-&view=keyterms&count=50&region="+region+"&lang="+lang+"' | sanitize()").results;
var terms = res.ysearchresponse.resultset_web.keyterms.terms;
var t = [];
for each(i in terms){t.push(i);};
t = t.sort();
var count = 0;
var others = [];
for(i=0,j=t.length;i<j;i++){
if(t[i+1] && t[i+1]!=t[i]){
others.push([t[i],count]);
count = 0;
} else {
count++
}
}
others.sort(function(a, b) {return a[1] - b[1]});
others.reverse();
var out = <terms/>;
var str = [];
var all = others.length > 20 ? 20 : others.length;
for(var i=0;i<all;i++){
var t = others[i][0];
str.push(t);
};
str = str.join(',')
response.object = <keywords><search>{term}</search><language>{lang}</language><region>{region}</region><terms>{str}</terms></keywords>;
]]></execute>
</select>
</bindings>
</table>
Jump to Line
Something went wrong with that request. Please try again.