Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: searchQuotations Arguments: query Description: Page type: webl Render function: Module: global Page source: var q = Wub_ReplaceAll(query, " ", " ") ? ""; var a = ""; if Size(OPTIONALARGS) > 0 then a = Wub_ReplaceAll(OPTIONALARGS[0], " ", " ") end; var url = "http://www.quotationspage.com/search.php3"; var P = GetURL(url, [. "Search"=q, "Author"=a .]) ? nil; var dt = []; if P != nil then dt = Elem(P, "dt"); end; var i = 0; var res = []; while (i < Size(dt)) do var c = dt[i].class ? nil; if c == "quote" then var q = [. quote = Str_Trim(Text(dt[i])) .]; var dd = Elem(P, "dd") directlyafter dt[i]; if (Size(dd) == 1) then var c2 = dd[0].class ? nil; if c2 == "author" then var author = Str_Trim(Text(dd[0])); var i = Str_IndexOf(" - More quotations", author); if (i > 0) then author = Str_Trim(Select(author, 0, i)) end; var A = Elem(P, "a") inside (dd[0]); if Size(A) > 0 then q.url := A[0].href ? nil; if Size(A) > 4 then author = Str_Trim(Text(A[4])); var rest = Str_Trim(Text(Parent(A[4]))); if Size(author) < Size(rest) then q.authorInfo := Select(rest, Size(author)+1, Size(rest)) end; end end; q.author := author; end end; res = res + [ q ]; end; i = i + 1; end; res; // [query] + OPTIONALARGS;