Labs/Ubiquity/Writing A Search Command: Difference between revisions

Line 190: Line 190:


=== Using the JSON parser ===
=== Using the JSON parser ===
CmdUtils.makeSearchCommand({
<pre>
  name: "Google",
CmdUtils.makeSearchCommand({
  url: "http://www.google.com/search?q={QUERY}",
  name: "Google",
  parser: {type: "JSON",
  url: "http://www.google.com/search?q={QUERY}",
            url: "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={QUERY}",
  parser: {
            container: "responseData.results",
    type: "json",
            title: "titleNoFormatting",
    url: "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={QUERY}",
            preview: "content",
    container: "responseData.results",
            href: "url"}
    title: "titleNoFormatting",
});
    body: "content",
    href: "url",
    html: ["body"],
  },
});
</pre>


=== Using functions in the parser ===
=== Using functions in the parser ===
73

edits