<?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/13974" />

	<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>2007-09-07T03:17:22-04:00</updated>

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

		<entry>
		<author><name><![CDATA[arcanedreams]]></name></author>
		<updated>2007-09-07T03:17:22-04:00</updated>

		<published>2007-09-07T03:17:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75771#p75771</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75771#p75771"/>
		<title type="html"><![CDATA[Trying to get some user stats of a forum with regexp. SOLVED]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75771#p75771"><![CDATA[
I put SOLVED in the title of this one..as this thread was made for problems with the actual regexp function.<br><br>My new thread is devoted to being able to login and redirect without errors.<br><br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>Oh, and I have added the ::http::cleanup thing..but I am not sure if it is working due to the $http variable that keeps increasing by 1 everytime I make a call.<br><br>But that can be discussed in my other thread.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9286">arcanedreams</a> — Fri Sep 07, 2007 3:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-09-07T00:30:35-04:00</updated>

		<published>2007-09-07T00:30:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75768#p75768</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75768#p75768"/>
		<title type="html"><![CDATA[Trying to get some user stats of a forum with regexp. SOLVED]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75768#p75768"><![CDATA[
You have 2 threads with the same topic going, so pick one and merge them =p<br><br>If you don't clean up your open sockets, eventually you'll have lots and lots of open sockets and it'll probably slow the system down and may even eventually be unable to open more, I assume most os's do impose a certain finite limit on the number of open sockets they can handle (like open files.)<br><br>The other benefits in that type of code is handling http errors so you know what's going on, and don't think the bot is not working, It's just good practice to test for error conditions and handle them gracefully.<br><br>And yes the man pages will be very useful if you're taking bits and pieces of code from here and there.. Understand what the code does, then you'll be writing your own code without looking at docs in a very short time (regexp, and the http &amp; socket code are a good challenge to start with, everything after that is easy <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Sep 07, 2007 12:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcanedreams]]></name></author>
		<updated>2007-09-06T19:27:42-04:00</updated>

		<published>2007-09-06T19:27:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75762#p75762</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75762#p75762"/>
		<title type="html"><![CDATA[Trying to get some user stats of a forum with regexp. SOLVED]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75762#p75762"><![CDATA[
What is all that extra stuff for? I realize the error checking thing..but a lot of that is all new to me.<br><br>This is my finished tested and working code I came up with:<br><div class="codebox"><p>Code: </p><pre><code>package require httpbind pub - !shooshstats shooshstatsproc shooshstats {nick host handle chan text} {set query "http://forums.shooshtime.com"set http [::http::geturl $query]set html [::http::data $http]regexp {&lt;div&gt;Threads: (.*?), Posts: (.*?), Members: (.*?)&lt;/div&gt;} $html - threads posts membersputserv "PRIVMSG $chan :There are currently $threads total threads, $posts total posts, and $members total members."}</code></pre></div><br>Is there a reason I should do it the way you suggested over mine? Is it more stable or faster or what?<br><br>What happens if I dont use the cleanup function?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9286">arcanedreams</a> — Thu Sep 06, 2007 7:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[r0t3n]]></name></author>
		<updated>2007-09-06T15:09:35-04:00</updated>

		<published>2007-09-06T15:09:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75761#p75761</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75761#p75761"/>
		<title type="html"><![CDATA[Trying to get some user stats of a forum with regexp. SOLVED]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75761#p75761"><![CDATA[
You should read the tcl http docs, you need to get the  body/data of the website using http::data, you then need to clean it up using http::cleanup.<br><br><br><div class="codebox"><p>Code: </p><pre><code>bind pub - !joined joinedproc joined {nick host handle chan text} {    set query "[http::formatQuery username $text]"    set token [::http::geturl http://forums.shooshtime.com/member.php -query $query]    set data [http::data $token]    if {[http::status] == "error"} {        putserv "PRIVMSG $chan :Error grabbing join data of $text."    } else {        set found "0"        foreach line [split $data \n] {            if {$line != "" &amp;&amp; [regexp -nocase {Join Date: &lt;strong&gt;(.*?)&lt;/strong&gt;} $line full date]} {                putserv "PRIVMSG $chan :$text joined on $date."                set found "1"                break            }        }        if {!$found} {            putserv "PRIVMSG $chan :Could not find join date for $text."        }    }    http::cleanup $token}</code></pre></div>Not tested, give it a try.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6300">r0t3n</a> — Thu Sep 06, 2007 3:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcanedreams]]></name></author>
		<updated>2007-09-06T14:04:34-04:00</updated>

		<published>2007-09-06T14:04:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75759#p75759</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75759#p75759"/>
		<title type="html"><![CDATA[Trying to get some user stats of a forum with regexp. SOLVED]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75759#p75759"><![CDATA[
Oh, and if anyone wants..they can try this version as a test for me if they really really wanted to, which shouldn't require any type of login at all.<br><br><div class="codebox"><p>Code: </p><pre><code>bind pub - !shooshstats shooshstatsproc shooshstats {nick host handle chan text} {set data [::http::geturl http://forums.shooshtime.com/] regexp {&lt;div&gt;Threads: (.*?),  Posts: (.*?), Members: (.*?)&lt;/div&gt;} $data - threads posts membersputserv "PRIVMSG $chan :There are currently $threads total threads, $posts total posts, and $members total members."}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9286">arcanedreams</a> — Thu Sep 06, 2007 2:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcanedreams]]></name></author>
		<updated>2007-09-06T13:52:11-04:00</updated>

		<published>2007-09-06T13:52:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75758#p75758</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75758#p75758"/>
		<title type="html"><![CDATA[Trying to get some user stats of a forum with regexp. SOLVED]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75758#p75758"><![CDATA[
Sorry, I'm new to the whole TCL thing.<br><br>What I have been doing is picking apart other scripts and figuring out how they work..then writing my own stuff based on that.<br><br>So far it has worked..until now.<br><br>Could you explain what the bit of code you posted does?<br><br><br>From looking at it I would assume that it sets the variable $data with whatever is in the [] brackets.<br><br>I am guessing that [::http::geturl $query] is a command that actually access the webpage in the $query variable.<br><br>So..I could actually do away with my $query variable all together and simply input the URL directly.<br><br><br>I am however still a little fuzzy on the <strong class="text-strong">regexp</strong> function. Is mine set up correctly?<br><br>The way I am understanding it is that it searches for the string that is in the {} brackets located in the $data variable.<br><br>It then inputs the (.*?) area into the variable $join.<br><br>Is the (.*?) a standard wildcard to take everything in that area..or does the *, and the ? signify different things? I know generally the * is a wildcard for any character, but I am not familiar with the . or the ?<br><br>So correct code would be:<br><div class="codebox"><p>Code: </p><pre><code>bind pub - !joined joinedproc joined {nick host handle chan text} {set data [::http::geturl http://forums.shooshtime.com/member.php?username=$text] regexp {Join Date: &lt;strong&gt;(.*?)&lt;/strong&gt;} $data - joinputserv "PRIVMSG $chan :$text joined on $join"}</code></pre></div>If I'm wrong let me know. I won't have a chance to test it out until I get out of class.<br><br>Thanks for your help though!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9286">arcanedreams</a> — Thu Sep 06, 2007 1:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-09-06T12:09:29-04:00</updated>

		<published>2007-09-06T12:09:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75756#p75756</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75756#p75756"/>
		<title type="html"><![CDATA[Trying to get some user stats of a forum with regexp. SOLVED]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75756#p75756"><![CDATA[
Where is the geturl call?  There's nothing in the $data var cos there's nothing getting it, like: <br><br>set data [::http::geturl $query]<br><br>As far as how to authenticate using the facilities available in tcl, I have not attempted it myself and don't know if its even possible (aside from a plain query/post type login). Maybe someone else has some info about that.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Thu Sep 06, 2007 12:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcanedreams]]></name></author>
		<updated>2007-09-06T21:35:44-04:00</updated>

		<published>2007-09-06T02:56:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75751#p75751</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75751#p75751"/>
		<title type="html"><![CDATA[Trying to get some user stats of a forum with regexp. SOLVED]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75751#p75751"><![CDATA[
Ok, so ...the user types "!joined &lt;username&gt;"<br><br>Then the bot should check the site and get the user's join date. In the source code for the page that the query is set to, the join date appears like this:<br><div class="codebox"><p>Code: </p><pre><code>&lt;div style="padding:3px"&gt;Join Date: &lt;strong&gt;09-30-2005&lt;/strong&gt;&lt;/div&gt;</code></pre></div><br>So..this is what I came up with. It doesn't work at all. Perhaps you guys can tell me where I went wrong?<br><br>This script is eventually going to be expanded upon to get the users post count, posts per day, birthday, ect...<br><br><div class="codebox"><p>Code: </p><pre><code>bind pub - !joined joinedproc joined {nick host handle chan text} {set query "http://forums.shooshtime.com/member.php?username=$text"regexp {Join Date: &lt;strong&gt;(.*?)&lt;/strong&gt;} $data - joinputserv "PRIVMSG $chan :$text joined on $join"}</code></pre></div><br>Thanks in advance!<br><br><br><br><br>It has come to my attention that the bot must log-in in order to be able to see the info it needs. So that is yet another dilemma  I have to overcome.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9286">arcanedreams</a> — Thu Sep 06, 2007 2:56 am</p><hr />
]]></content>
	</entry>
	</feed>
