egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Print basic info from website

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
offndr
Voice


Joined: 04 Jan 2005
Posts: 6

PostPosted: Tue Nov 18, 2008 3:48 am    Post subject: Print basic info from website Reply with quote

hi

I want a script that when I do !text it takes information from
http://svt.se/svttext/web/pages/358.html and prints the whole table of stats into my channel(It is kind of experimental so it doesnt realy matter how it looks like, the main part is that something goes into the channel).

Further on I want to implement a !search function that for example !text <searchword> does output the whole row of that searchword.
So, If I do !text <modo> it should output the whole row for modo stats only.

Is this possible?
I would appreciate this ALOT
Thank you
Back to top
View user's profile Send private message
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Thu Nov 20, 2008 9:03 am    Post subject: Reply with quote

you must use sockets to do that i need to learn about sockets is very usefull so i would know who you can do that if someone want to make it .
gl
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Thu Nov 20, 2008 12:22 pm    Post subject: Reply with quote

Code:
namespace eval svt {}
setudef flag nopubsvt
set svt(pref) "!"
set svt(commands) "svt"
set svt(time) 30
set svt(page) http://svt.se/svttext/web/pages/358.html
set svt(version) "1.0"
set svt(author) "tvrsh @ IrcNet.ru"
package require http
foreach bind [split $svt(commands) " "] {
   bind pub -|- $svt(pref)$bind ::svt::pub
   bind msg -|- $svt(pref)$bind ::svt::msg
}

proc ::svt::msg {nick uhost hand arg} {
    ::svt::svt $nick $uhost $hand $nick $arg
}

proc ::svt::pub {nick uhost hand chan arg} {
   if {[channel get $chan nopubsvt]} return
   ::svt::svt $nick $uhost $hand $chan $arg
}

proc ::svt::svt {nick uhost hand chan arg} {
   global svt lastbind
      set arg [lindex [split $arg] 0]
   if {[info exists svt(host,$uhost)]} {
      if {$chan == $nick} {
         putquick "PRIVMSG $nick :\00303Wait \00304$svt(time) \00303seconds before next request."
         return
      } else {
         putquick "NOTICE $nick :\00303Wait \00304$svt(time) \00303seconds before next request."
         return
      }
   }
   
     
      set agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"
   set svt(host,$uhost) 1
   set svt(timer,$uhost) [utimer $svt(time) [list ::svt::reset $uhost ] ]
   set svt_tok [::http::config -useragent $agent]
   set svt_tok [::http::geturl $svt(page) -timeout 30000] 
   set html [::http::data $svt_tok]
   ::http::cleanup $svt_tok

       set rgx "<span\\\ class=\\\"W\\\ bgB\\\">(.*?)<div\\\ class=\\\"subWrapper\\\">"
       regsub -all -- {\n} $html "" html
           foreach line [split $html \n] {
               if {[regexp -nocase -- $rgx $line garb data]} {
               set html $data
               regsub -all -- {</span><span.*?>} $html " " html
               regsub -all -- {<span\ class=.*?>} $html "|" html
               regsub -all -- {</span>} $html "" html
               regsub -all -- {</div>} $html "" html
               regsub -all -- {</pre>} $html "" html
               regsub -all -- {\s+} $html " " html
               #putlog $html
                  foreach line [split $html "|"] {
                      if {$line != " "} { putserv "PRIVMSG $chan :\00302$line" }
                  }
               return
      }   
   }
}

proc ::svt::reset { uhost } {
    global svt
    catch {killutimer $svt(timer,$uhost)}
     catch {unset svt(timer,$uhost)}
      catch {unset svt(host,$uhost)}
}

putlog "svt.tcl v$svt(version) by $svt(author) loaded."


This is the result:
Quote:
[19:19:53] <tvrsh> !svt
[19:19:53] <bionic> ISHOCKEY Elitserien (55 omg.)
[19:19:53] <bionic> 17/11 Frцlunda - Sцdertдlje 3-2
[19:19:53] <bionic> Linkцping - Rцgle 3-1
[19:19:53] <bionic> Modo - Skellefteе 0-6
[19:19:53] <bionic> 18/11 HV71 - Luleе 1-1 SD
[19:19:53] <bionic> Fдrjestad - Timrе 2-0
[19:19:56] <bionic> Djurgеrden - Brynдs 2-4
[19:19:58] <bionic> S V O F VЦ GM IM P
[19:20:00] <bionic> 1 Linkцpin 22 12 5 5 1 65- 50 42
[19:20:01] <bionic> 2 Skelleft 22 10 5 7 1 66- 54 36
[19:20:04] <bionic> 3 Fдrjesta 22 11 3 8 0 53- 47 36
[19:20:06] <bionic> 4 Brynдs 22 10 3 9 2 51- 58 35
[19:20:08] <bionic> 5 Rцgle 22 9 5 8 1 62- 59 33
[19:20:09] <bionic> 6 Modo 23 9 4 10 2 66- 71 33
[19:20:12] <bionic> 7 Luleе 22 9 5 8 0 60- 57 32
[19:20:14] <bionic> 8 Frцlunda 22 8 5 9 2 55- 56 31
[19:20:16] <bionic> 9 HV71 22 7 7 8 3 60- 62 31
[19:20:17] <bionic> 10 Djurgеrd 23 6 8 9 3 63- 66 29
[19:20:20] <bionic> 11 Timrе 22 6 5 11 4 55- 66 27
[19:20:22] <bionic> 12 Sцdertдl 22 5 7 10 2 53- 63 24
[19:20:24] <bionic> Kommande omgеngar sid. 359

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber