View previous topic :: View next topic |
Author |
Message |
_niCk Voice
Joined: 08 Oct 2018 Posts: 4 Location: [IN]
|
Posted: Mon Nov 19, 2018 5:33 pm Post subject: Do anyone has the working !fml tcl for the eggdrop? |
|
|
Greetings,
It's been more than a month now, the !fml script has stopped giving a result while triggered.
Please help!
Best,
_niCk |
|
Back to top |
|
 |
heartbroken Halfop

Joined: 23 Jun 2011 Posts: 98 Location: somewhere out there
|
Posted: Tue Nov 20, 2018 7:37 am Post subject: |
|
|
.chanset #channel +FML
TclTLS : https://core.tcl.tk/tcltls/wiki/Download (tls package)
tcllib : https://github.com/tcltk/tcllib (htmlparse package)
Code: | package require http
package require tls
package require htmlparse
proc do_fml {} {
if {[package vcompare [package present tls] 1.7] > 0} {
::http::register https 443 [list ::tls::socket -autoservername true]
} else {
::http::register https 443 [list ::tls::socket -request 0 -require 1 -ssl2 0 -ssl3 0 -tls1 1]
}
::http::config -useragent "Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7e" -urlencoding "utf-8"
if {[catch {set token [http::geturl https://www.fmylife.com/random -binary 0 -timeout 15000]} err]} {
putlog "FML Error: $err"
return 0
}
if {[http::status $token] eq "ok" && [http::ncode $token] == "200"} {
set html [http::data $token]
::http::cleanup $token
set out [list ]
foreach {null data} [regexp -all -inline {block hidden\-xs\">.+?<a href=\"/article/today.+?.html\">(.*?)</a>} $html] {
regsub -all -- {(<[^<>]+/>)} $data "" data
regsub -all {FML} $data \00304\002\\0\003 data
lappend out [split [string trim $data]]
}
set fmlout [lindex $out [expr {int(rand()*[llength $out])}]]
} else {
set fmlout "FML Error: [http::status $token] - [http::code $token]"
::http::cleanup $token
}
::http::unregister https
return $fmlout
}
bind pub -|- !fml fml_pubin
proc fml_pubin {nick uhost hand chan text} {
if {![channel get $chan FML]} { return 0 }
puthelp "PRIVMSG $chan :[join [htmlparse::mapEscapes [do_fml]]]"
}
setudef flag FML
|
Edited: ::http::register https … lines moved inside of the proc. _________________ Life iS Just a dReaM oN tHE wAy to DeaTh
Last edited by heartbroken on Wed Nov 21, 2018 8:08 am; edited 2 times in total |
|
Back to top |
|
 |
_niCk Voice
Joined: 08 Oct 2018 Posts: 4 Location: [IN]
|
Posted: Tue Nov 20, 2018 4:57 pm Post subject: |
|
|
Thank you for the script, heartbroken.
The script worked just great at the very first trigger but after that, it didn't give the results instead returned 0.
PS
@_niCK ¦ !fml
+Twitler ¦ Today, after moving in with a couple of vegan zoologists a few weeks ago, I discover that they don't believe that we have the right to kill cockroaches, and will not allow me to do so. The house is infested, and it's spread to my bedroom. FML
@_niCk ¦ !fml
+Twitler ¦ 0
@_niCk ¦ !fml
+Twitler ¦ 0
In the bot party line, I am getting this error!
FML Error: Unsupported URL type "https"
FML Error: Unsupported URL type "https"
Please advise.
Thnx,
_niCk |
|
Back to top |
|
 |
heartbroken Halfop

Joined: 23 Jun 2011 Posts: 98 Location: somewhere out there
|
Posted: Wed Nov 21, 2018 8:05 am Post subject: |
|
|
I've edited the script above. You're welcome! _________________ Life iS Just a dReaM oN tHE wAy to DeaTh |
|
Back to top |
|
 |
Dominatez Voice

Joined: 14 Jan 2019 Posts: 36 Location: United Kingdom
|
Posted: Mon May 27, 2019 4:49 pm Post subject: |
|
|
This for some odd reason was working and now has stopped.
Keeps with the error :
FML Error: timeout -
Any ideas ? |
|
Back to top |
|
 |
heartbroken Halfop

Joined: 23 Jun 2011 Posts: 98 Location: somewhere out there
|
Posted: Mon May 27, 2019 6:29 pm Post subject: |
|
|
just replace :
Code: | foreach {null data} [regexp -all -inline {block hidden\-xs\">.+?<a href=\"/article/today.+?.html\">(.*?)</a>} $html] { |
to:
Code: | foreach {null data} [regexp -all -inline {article\-topbar\">.+?<a href=\"/article/today.+?.html\">(.*?)</a>} $html] { |
_________________ Life iS Just a dReaM oN tHE wAy to DeaTh |
|
Back to top |
|
 |
Dominatez Voice

Joined: 14 Jan 2019 Posts: 36 Location: United Kingdom
|
Posted: Fri May 31, 2019 5:50 am Post subject: |
|
|
Thank you Heartbroken.
Works like a charm. |
|
Back to top |
|
 |
Dominatez Voice

Joined: 14 Jan 2019 Posts: 36 Location: United Kingdom
|
Posted: Sun May 24, 2020 5:36 pm Post subject: |
|
|
Just tested this script and when i use !fml it answers with 0
Yep. That's a ZERO.
Not sure what the issue is.
Just noticed inside the eggdrop when i logged in, that it is spitting this out.
FML Error: error flushing "sock2bf05e0": connection reset by peer
UPDATE : Ok Now. Updating To 19.10 Linux has cured whatever issue it had. |
|
Back to top |
|
 |
|