Skip to content

Instantly share code, notes, and snippets.

@edorcutt
Created August 17, 2010 04:09
Show Gist options
  • Save edorcutt/528425 to your computer and use it in GitHub Desktop.
Save edorcutt/528425 to your computer and use it in GitHub Desktop.
ruleset a169x74 {
meta {
name "annotate-google-query"
description <<
Annotate Google search results
http://devex.kynetx.com/questions/537/accessing-dom-elements-from-kynetx-server-environment
>>
author "Ed Orcutt http://edorcutt.org"
logging on
}
dispatch {
domain "google.com"
}
global {
datasource google:HTML <- "http://www.google.com/search?";
}
rule annotate_google is active {
select when pageview "http://www.google.com/.*search.*(?:&|\?)(?:p|q)=(.*?)(:?&|$)" setting (keywords)
foreach (datasource:google("q="+keywords).query("div#ires ol li.g h3.r a.l")) setting (item)
pre {
MyURL = item.replace(/.*(http[\w|\/|:|\?|&|\.|\-|_|=]*).*\n/,"$1");
}
notify("MyURL: ", MyURL) with sticky = true;
// Make an interesting Kynetx library call here with MyURL
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment