forked from yql/yql-tables
/
YVoices.fans.xml
59 lines (59 loc) · 2.23 KB
/
YVoices.fans.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd" securityLevel="any">
<meta>
<author>HOUYHNHNM</author>
<description> Gets Fans of a YAhoo Contributor (based on yahoo's selection process on a user's frontpage,maximum results are 12)</description>
<documentationURL></documentationURL>
<sampleQuery>select * from {table} where query="http://contributor.yahoo.com/user/270293/carol_rucker.html"</sampleQuery>
</meta>
<bindings>
<select itemPath="" produces="XML">
<inputs>
<key id="query" type="xs:string" paramType="variable" required="true"/>
</inputs>
<execute>
<![CDATA[
var str1="select * from html where url=\"http://sports.yahoo.com/soccer/morenews/Yahoo!+Contributor+Network\" and xpath='//div[@id=\"yui-main\"]/div/div[@class=\"bd\"]'";
var str1="select * from html where url=\"";
var str2="\" and xpath='//div[@class=\"prim_col_sect clearfix\"][3]'";
var yqlquery=y.query(str1+query+str2);
var yqlresults=yqlquery.results;
var yqlcounter2=parseInt(yqlresults.div.a.length());
var substr="http://contributor.yahoo.com";
var subregex="";
var subregex2="";
var subregex3="";
var subregex4="";
var patt1 = /[^/]*$/;
var patt2 = /[^.]*/;
var patt3 = /[^_]*/;
var patt4 = /[^_]*$/;
var index=0;
var xmlret=new XML();
xmlret=<root><count>{yqlcounter2}</count></root>;
if(yqlcounter2>12)
{
yqlcounter2--;
}
while(index<yqlcounter2)
{
if((yqlresults.div)&&(yqlresults.div.a[index].img))
{
subregex=yqlresults.div.a[index].@href;
subregex2=new String(subregex.match(patt1));
subregex3=new String(subregex2.match(patt2));
xmlret.root+=<node>
<title>{subregex4.concat(subregex3.match(patt3)," ",subregex3.match(patt4))}</title>
<description>{subregex4.concat(subregex3.match(patt3)," ",subregex3.match(patt4))}</description>
<link>{substr.concat(yqlresults.div.a[index].@href)}</link>
<mediaimg>{yqlresults.div.a[index].img.@src}</mediaimg>
</node>
index++;
}
}
response.object=xmlret;
]]>
</execute>
</select>
</bindings>
</table>