This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

How can we use exist command for web read?

Help for those learning Tcl or writing their own scripts.
Post Reply
R
Regex
Voice
Posts: 19
Joined: Sat Mar 19, 2011 1:23 pm

How can we use exist command for web read?

Post by Regex »

Hi, nowadays i'm workin' with http tcl.

Code: Select all

bind pub - !superlig superlig 
proc superlig {nick uhost hand chan text} { 
  global botnick
  set connect [::http::geturl http://sporistatistik.hurriyet.com.tr/] 
  set files [::http::data $connect] 
  regexp -nocase {<div class="PuanDurumuBaslik FL"><span style="color:#000">(.+?)</span>} $files - sayi
  regexp -nocase {</span> (.+?)</div>} $files - team
  regexp -nocase {<div class="PuanDurumuPuan_2 FL">(.+?)</div>} $files - puan
  ::http::cleanup $files 
  putquick "privmsg $chan $sayi $team ($puan)" 
}
This is my simple script but bot givin' only one message. Other teams aint givin' by bot. How can we correct this?
i
iRoc

Post by iRoc »

Code: Select all

6:54:57pm / * <iRoc> !superlig
6:54:59pm / * <iB0T>  1- Galatasaray 32 21 8 3 63 24 71 
6:55:00pm / * <iB0T>  2- Fenerbahçe 32 19 7 6 58 33 64 
6:55:01pm / * <iB0T>  3- Trabzonspor 32 15 9 8 59 38 54 
6:55:02pm / * <iB0T>  4- Be_ikta_ 32 15 9 8 49 37 54 
6:55:04pm / * <iB0T>  5- Sivasspor 32 12 11 9 55 52 47 
6:55:07pm / * <iB0T>  6- Bursaspor 32 12 10 10 41 32 46 
6:55:08pm / * <iB0T>  7- Gençlerbirlii 32 12 10 10 46 47 46 
6:55:10pm / * <iB0T>  8- Eski_ehirspor 32 13 7 12 38 39 46 
6:55:12pm / * <iB0T>  9- Gaziantepspor 33 12 9 12 37 33 45 
6:55:14pm / * <iB0T>  10- 0stanbul B^B 32 12 8 12 46 49 44 
6:55:16pm / * <iB0T>  11- KDÇ Karabükspor 33 13 4 16 43 55 43 
6:55:18pm / * <iB0T>  12- Mersin 0dman Yurdu 33 12 6 15 34 43 42 
6:55:20pm / * <iB0T>  13- Orduspor 32 10 11 11 28 32 41 
6:55:22pm / * <iB0T>  14- Kayserispor 32 12 4 16 35 37 40 
6:55:24pm / * <iB0T>  15- M.P. Antalyaspor 32 10 9 13 31 37 39 
6:55:26pm / * <iB0T>  16- Samsunspor 32 8 9 15 34 45 33 
6:55:28pm / * <iB0T>  17- Manisaspor 32 8 8 16 31 45 32 
6:55:30pm / * <iB0T>  18- Ankaragücü 33 2 5 26 22 72 11 

Code: Select all

package require http
bind pub - !superlig superlig
proc superlig {nick uhost hand chan text} {
set t [::http::geturl http://sporistatistik.hurriyet.com.tr/]
	set data [::http::data $t]
	::http::cleanup $t
	   
	set l [regexp -all -inline -- {<div class="PuanDurumuBaslik FL">(.*?)</div>.*?<div class="PuanDurumuPuan FL">(.*?)</div>.*?<div class="PuanDurumuPuan FL">(.*?)</div>.*?<div class="PuanDurumuPuan FL">(.*?)</div>.*?<div class="PuanDurumuPuan FL">(.*?)</div>.*?<div class="PuanDurumuPuan FL">(.*?)</div>.*?<div class="PuanDurumuPuan FL">(.*?)</div>.*?<div class="PuanDurumuPuan_2 FL">(.*?)</div>} $data]
		
	   foreach {black a b c d e f g h} $l {
		   
		   set a [string trim $a " \n"]
		   set b [string trim $b " \n"]
		   set c [string trim $c " \n"]
		   set d [string trim $d " \n"]
		   set e [string trim $e " \n"]
		   set f [string trim $f " \n"]
		   set g [string trim $g " \n"]		   
		   set h [string trim $h " \n"]		   		   
		      
		   regsub -all {<.+?>} $a {} a
		   regsub -all {<.+?>} $b {} b
		   regsub -all {<.+?>} $c {} c		   
		   regsub -all {<.+?>} $d {} d
		   regsub -all {<.+?>} $e {} e
		   regsub -all {<.+?>} $f {} f
		   regsub -all {<.+?>} $g {} g
		   regsub -all {<.+?>} $h {} h		   
   
		   
	putserv "PRIVMSG $chan : $a $b $c $d $e $f $g $h "
   }
}
Post Reply