| View previous topic :: View next topic |
| Author |
Message |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Fri Dec 30, 2005 3:43 pm Post subject: simple question |
|
|
| 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 |
|
 |
avilon Halfop

Joined: 13 Jul 2004 Posts: 64 Location: Germany
|
Posted: Fri Dec 30, 2005 4:37 pm Post subject: |
|
|
| 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 |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Sat Dec 31, 2005 6:20 am Post subject: |
|
|
Why | Code: |
puthelp "PRIVMSG $chan :($count) $title" | title? |
|
| Back to top |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Sat Dec 31, 2005 9:33 am Post subject: |
|
|
| And next question, why only 1 regexp works? if i try to use 2 or more don`t works ;/ |
|
| Back to top |
|
 |
avilon Halfop

Joined: 13 Jul 2004 Posts: 64 Location: Germany
|
Posted: Sat Dec 31, 2005 11:51 am Post subject: |
|
|
| What's your problem? The script is faultless, isn't it? |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sat Dec 31, 2005 1:33 pm Post subject: |
|
|
| 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 |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Sat Dec 31, 2005 5:58 pm Post subject: |
|
|
| 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 |
|
 |
avilon Halfop

Joined: 13 Jul 2004 Posts: 64 Location: Germany
|
Posted: Sat Dec 31, 2005 6:03 pm Post subject: |
|
|
*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 |
|
 |
|