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 

simple question

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Fri Dec 30, 2005 3:43 pm    Post subject: simple question Reply with quote

Code:
package require http
bind pub - !news www:news
proc www:news {nick host handle chan text} {
   set data [http::data [http::geturl http://www.sensiblesoccer.de/index.php?lng=en]]
   regexp {<td class="medium"><b class="marker">(.*?)</font></td>} $data data match
   puthelp "PRIVMSG $chan :$match"

}


How to get for example frist 3 news not only 1? i tried set limit but dont works
Back to top
View user's profile Send private message
avilon
Halfop


Joined: 13 Jul 2004
Posts: 64
Location: Germany

PostPosted: Fri Dec 30, 2005 4:37 pm    Post subject: Reply with quote

Code:
package require http

bind pub - !news www:news

proc www:news {nick host handle chan text} {
   set token [::http::geturl http://www.sensiblesoccer.de/index.php?lng=en -timeout 10000]
   set status [::http::status $token]
   if {$status!="ok"} {
      switch -exact -- [string tolower $status] {
         reset   { puthelp "PRIVMSG $chan :error: server connection was reset." }
         timeout { puthelp "PRIVMSG $chan :error: server timeout (10 seconds)"   }
         default { puthelp "PRIVMSG $chan :unknown server error occured"      }
      }
      ::http::cleanup $token; return
   }
   if {[::http::ncode $token]=="404"} {
      ::http::cleanup $token
      puthelp "PRIVMSG $chan :Sorry, error 404"; return
   }
   set data [::http::data $token]; ::http::cleanup $token
   set all [regexp -all -inline -nocase -- {<td class="medium"><b class="marker">(.*?)</font></td>} $data]
   set count 1
   foreach {tmp title} $all {
      if {$count=="4"} {return}
      puthelp "PRIVMSG $chan :($count) $title"
      incr count
   }
}
Back to top
View user's profile Send private message
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Sat Dec 31, 2005 6:20 am    Post subject: Reply with quote

Why
Code:

puthelp "PRIVMSG $chan :($count) $title"
title?
Back to top
View user's profile Send private message
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Sat Dec 31, 2005 9:33 am    Post subject: Reply with quote

And next question, why only 1 regexp works? if i try to use 2 or more don`t works ;/
Back to top
View user's profile Send private message
avilon
Halfop


Joined: 13 Jul 2004
Posts: 64
Location: Germany

PostPosted: Sat Dec 31, 2005 11:51 am    Post subject: Reply with quote

What's your problem? The script is faultless, isn't it?
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sat Dec 31, 2005 1:33 pm    Post subject: Reply with quote

FcLan wrote:
And next question, why only 1 regexp works? if i try to use 2 or more don`t works ;/

"doesnt work" is no error description and is useless to assisst you.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Sat Dec 31, 2005 5:58 pm    Post subject: Reply with quote

I want to use more than 1 regexp (if i use 2 or more script don`t works) I don`t want to download only frist news, I want to use a set limit "any_number" but dont works
Back to top
View user's profile Send private message
avilon
Halfop


Joined: 13 Jul 2004
Posts: 64
Location: Germany

PostPosted: Sat Dec 31, 2005 6:03 pm    Post subject: Reply with quote

*sigh* Have you even tested my script?

e//:
Quote:
(23:44:44) (@avilon) !news
(23:44:45) (+bot) (1) Eifel X-Mas PC Cup
(23:44:47) (+bot) (2) NEW: Comments
(23:44:49) (+bot) (3) Exclusive Interview with Jon Hare

That's what you requested.
Btw.: I can't believe you are not able to express yourself. 90% of your board postings contain nothing more than "dont works", never a specific error description..
I saw you asking the same questions on IRC for days, how about reading some tutorials and references, and trying to UNDERSTAND what people advice you.

This is my last post in this topic, use my script or continue asking unsubstantial questions.


Last edited by avilon on Sat Dec 31, 2005 6:54 pm; edited 2 times in total
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Scripting Help 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