TclScripts/UrlGrab

How to grab URLs from IRC channels ,save them to mysql, and display them on a webpage:

urlgrab.tcl v0.7 by RufusDE  already handles all the [RegularExpressions regex]'ing nicely, and because [HackerAttitude no problem should ever be solved twice], we just take this one to start with.

It only logs to a text file though, but we have libmysqltcl installed (on s23.org) so we can add MySql commands like this:

set db [mysqlconnect -host localhost -user -password -db ircurls] mysqlexec $db "INSERT INTO urlgrab SET url="$url",chan="$lchan",nick="$nick",date=now" puthelp "privmsg mutante :Added to sql-db : url: $url chan: $lchan nick: $nick date: $ctime" mysqlclose $db
 * 1) added sql insert by mutante

i inserted this between row 51 - 57 in the original script.

replace and with your mysql user / pass.

You need to create a database "ircurls" with a table "urlgrab" or whatever you like,

and the table structure is :

Table structure for table `urlgrab`

CREATE TABLE urlgrab ( id int(5) unsigned NOT NULL auto_increment,  url varchar(255) default NULL,  nick varchar(32) default NULL,  chan varchar(64) default NULL,  date datetime NOT NULL default '0000-00-00 00:00:00',  PRIMARY KEY  (id) ) TYPE=MyISAM;


 * Now to the output part / webinterface:

You can use f.e. php (or perl) to read from mysql:

Example:

%s %s %s %s ",  $myrow[0], $myrow[1], $myrow[1], $myrow[2], $myrow[3], $myrow[4],$myrow[5]);

$urlnum++; }

echo " Total URLs found: $urlnum "; echo " ";

which,if you play more with it, looks something like:

http://mutante.s23.org/urllog.php, broken link

While creating all this i found out Rufus already offers mysql_urlgrab.tcl, DOH!!!

So you could as well just use that ,but i didnt check it out yet ;)

Rufus is also the maintainer of libmysqltcl himself it seems, so he should know pretty good.

mutante