Skip to content

Instantly share code, notes, and snippets.

@izabera
Last active August 29, 2015 14:04
Show Gist options
  • Save izabera/71d3aaf82a0e7df31756 to your computer and use it in GitHub Desktop.
Save izabera/71d3aaf82a0e7df31756 to your computer and use it in GitHub Desktop.
kvirc google search
%string=$0-
%string=$str.replace(%string," ","+")
%string=http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=%string
http.asyncGet -e=o -w=h -i=$window (%string,$file.localdir(result))
{
%string=$file.read($file.localdir(result));
%url[]=$str.split(:\",%string);
for(%i=1;%i < %url[]#;%i+=2)
{
%temp=""
if ($str.grep("unescapedurl",%url[%i]))
{
%len=$($str.len(%url[%i+1])-7)
%temp=$str.strip($str.left(%url[%i+1],%len))
#titlenoformatting
%len=$($str.len(%url[%i+6])-11)
%temp=%temp - $str.left(%url[%i+6],%len)
}
%temp=$str.replace(%temp,"\\u0026","&",1)
%temp=$str.replace(%temp,"\\u003d","=",1)
%temp=$str.replace(%temp,"&quot;","\"",1)
%temp=$str.replace(%temp,"&gt;",">",1)
%temp=$str.replace(%temp,"&lt;","<",1)
%temp=$str.replace(%temp,"&Agrave;","À",1)
%temp=$str.replace(%temp,"&Aacute;","Á",1)
%temp=$str.replace(%temp,"&Egrave;","È",1)
%temp=$str.replace(%temp,"&Eacute;","É",1)
%temp=$str.replace(%temp,"&Igrave;","Ì",1)
%temp=$str.replace(%temp,"&Iacute;","Í",1)
%temp=$str.replace(%temp,"&0grave;","Ò",1)
%temp=$str.replace(%temp,"&0acute;","Ó",1)
%temp=$str.replace(%temp,"&Ugrave;","Ù",1)
%temp=$str.replace(%temp,"&Uacute;","Ú",1)
%temp=$str.replace(%temp,"&agrave;","à",1)
%temp=$str.replace(%temp,"&aacute;","á",1)
%temp=$str.replace(%temp,"&egrave;","è",1)
%temp=$str.replace(%temp,"&eacute;","é",1)
%temp=$str.replace(%temp,"&igrave;","ì",1)
%temp=$str.replace(%temp,"&iacute;","í",1)
%temp=$str.replace(%temp,"&ograve;","ò",1)
%temp=$str.replace(%temp,"&oacute;","ó",1)
%temp=$str.replace(%temp,"&ugrave;","ù",1)
%temp=$str.replace(%temp,"&uacute;","ú",1)
%temp=$str.replace(%temp,"&euro;","€",1)
say -r=$3 %temp
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment