<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/19418" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2013-05-13T10:34:42-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/19418</id>

		<entry>
		<author><name><![CDATA[x0x]]></name></author>
		<updated>2013-05-13T10:34:42-04:00</updated>

		<published>2013-05-13T10:34:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101498#p101498</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101498#p101498"/>
		<title type="html"><![CDATA[Add URL shortener to existing Google script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101498#p101498"><![CDATA[
Would it be possible to convert the Google search result urls to short urls using one or multiple URL shorteners?<br><div class="codebox"><p>Code: </p><pre><code>set googlecmdchar "!"proc google {nick host hand chan type search} {  if {[lsearch -exact [channel info $chan] +google] != -1} {    set googlectry "en"    set googlemax "5"    set googlelogo "\00312G\003\00304o\003\00307o\003\00312g\003\00303l\003\00304e\003"    set textf ""    set linkf ""    set googlesite ajax.googleapis.com    set googleurl /ajax/services/search/${type}?v=1.0&amp;rsz=large&amp;q=${search}&amp;ql=${googlectry}&amp;lr=lang_${googlectry}    if {[catch {set googlesock [socket -async $googlesite 80]} sockerr]} {      putlog "$googlesite $googleurl $sockerr error"      return 0      } else {      puts $googlesock "GET $googleurl HTTP/1.0"      puts $googlesock "Host: $googlesite"      puts $googlesock "User-Agent: Opera 9.6"      puts $googlesock ""      flush $googlesock      while {![eof $googlesock]} {        set googlevar " [gets $googlesock] "        set googlelink [regexp -all -nocase -inline {\"url\":\"([^\"]*)\"} $googlevar]        set googledesc [regexp -all -nocase -inline {\"title\":\"([^\"]*)\"} $googlevar]        if {$googledesc != "" &amp;&amp; $googlelink != ""} {          for {set x 1} {$x &lt;= [expr 2 * $googlemax]} {incr x 2} {            putquick "PRIVMSG $chan :$googlelogo $textf[dehex [lindex $googledesc $x]] $linkf[dehex [lindex $googlelink $x]]"           }        }      }      close $googlesock      return 0     }  }}proc asc {chr} {  scan $chr %c asc  return $asc}proc chr {asc} { return [format %c $asc] }proc hex {decimal} { return [format %x $decimal] }proc decimal {hex} { return [expr 0x$hex] }proc dehex {string} {  regsub -all {^\{|\}$} $string "" string  set string [subst [regsub -nocase -all {\\u([a-f0-9]{4})} $string {[format %c [decimal \1]]}]]  set string [subst [regsub -nocase -all {\%([a-f0-9]{2})} $string {[format %c [decimal \1]]}]]  set string [subst [regsub -nocase -all {\&amp;#([0-9]{2});} $string {[format %c \1]}]]  set string [string map {" \" · · &amp; &amp; &lt;b&gt; "" &lt;/b&gt; ""} $string]  return $string}proc urlencode {string} {  regsub -all {^\{|\}$} $string "" string  return [subst [regsub -nocase -all {([^a-z0-9])} $string {%[format %x [scan "\\&amp;" %c]]}]]}proc googleweb {nick host hand chan args} { google $nick $host $hand $chan "web" [urlencode $args] }proc googlelocal {nick host hand chan args} { google $nick $host $hand $chan "local" [urlencode $args] }proc googlevideo {nick host hand chan args} { google $nick $host $hand $chan "video" [urlencode $args] }proc googlenews {nick host hand chan args} { google $nick $host $hand $chan "news" [urlencode $args] }proc googlebook {nick host hand chan args} { google $nick $host $hand $chan "books" [urlencode $args] }proc googleimage {nick host hand chan args} { google $nick $host $hand $chan "images" [urlencode $args] }proc googlepatent {nick host hand chan args} { google $nick $host $hand $chan "patent" [urlencode $args] }bind pub - ${googlecmdchar}google googlewebbind pub - ${googlecmdchar}glocal googlelocalbind pub - ${googlecmdchar}gvideo googlevideobind pub - ${googlecmdchar}gnews googlenewsbind pub - ${googlecmdchar}gbook googlebookbind pub - ${googlecmdchar}gimage googleimagebind pub - ${googlecmdchar}gpatent googlepatentsetudef flag google</code></pre></div>The credits for the author are missing, I found this on the web and stripped it. If you are the author or know the author please let me know so that I can add the credits for this script.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10486">x0x</a> — Mon May 13, 2013 10:34 am</p><hr />
]]></content>
	</entry>
	</feed>
