| View previous topic :: View next topic |
| Author |
Message |
Sane Voice
Joined: 17 Nov 2013 Posts: 19 Location: #kl-channel@Rizon.net
|
Posted: Sun May 06, 2018 3:59 pm Post subject: fmylife.com eggdrop tcl script request |
|
|
Hi,
I was wondering if anyone had a working version of any of the FML scripts out there?
Or if if anyone can provide a fix for any of the fml scripts already out there? I can provide a few fml TCL pastes of code for someone to look at if need be; maybe they could fiddle with them and get them working.
Failing that, it would be amazing if someone could write a new script to fetch random FML quotes from fmylife.com
Many thanks in advance.
P.S I have searched Google of course and all the tcl/eggdrop repositories and archives that I could find, including Hawkee and some other sites but all the ones that I've tried out, and ones that I have used in the past, no longer work. Obviously due the site and layout changes overtime.
I have asked in a few IRC channels as well -- #eggdrop, #tcl, #egghelp, #script-help etc... on various servers, but I think people were away and some weren't able to help unfortunately; but I appreciate them trying though. |
|
| Back to top |
|
 |
silentziler Voice
Joined: 09 Sep 2015 Posts: 11
|
Posted: Wed May 09, 2018 10:55 pm Post subject: fml script |
|
|
| Code: |
############################################
# Command for random fml quote = !fml #
############################################
bind pub - !fml pub_FML
proc pub_FML {nick uhost handle chan text} {
package require http
## UNCOMMENT FOR HTTPS ## package require tls
## UNCOMMENT FOR HTTPS ## http::register https 443 [list ::tls::socket -tls1 1]
set agent "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
set token [http::config -useragent $agent]
set token [http::geturl "http://www.fmylife.com/random"]
set html [http::data $token]
http::cleanup $token
## UNCOMMENT FOR HTTPS ## http::unregister https
regexp {<p class="block hidden-xs">(.*?)</a>} $html - a
regsub -all {<[^>]*>} $a {} a
regsub -all {[\r\t\n]+} $a "" a
putserv "PRIVMSG $chan : $a"
}
putlog "Random FML loaded!"
|
Run !fml for random quote.
Let me know if you have any issues. |
|
| Back to top |
|
 |
SVD Voice
Joined: 13 Mar 2006 Posts: 9
|
Posted: Mon Oct 29, 2018 2:37 pm Post subject: |
|
|
I get the following error on Windrop 1.8.3:
| Code: | Tcl error [pub_FML]: can't read "a": no such variable
can't read "a": no such variable
while executing
"regsub -all {<[^>]*>} $a {} a"
(procedure "pub_FML" line 15)
invoked from within
"pub_FML $_pub1 $_pub2 $_pub3 $_pub4 $_pub5" |
I'm sure it's a simple fix - any ideas? Thanks in advance! |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Oct 30, 2018 2:08 am Post subject: |
|
|
You get that error because the normal http page doesn't return any content and actually redirects to the https one. Load the https part of the code and should work.
Btw, I tried the code and returns the same quote every time. So much for random... _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Dominatez Halfop

Joined: 14 Jan 2019 Posts: 46 Location: United Kingdom
|
Posted: Mon May 27, 2019 5:18 pm Post subject: |
|
|
This was never gonna work caesar.
There is something missing.
He closes a tag </a> but never actually opens one which i assume to be where he is grabbing the data from.
And i keep getting the following error no matter what i do.
And that includes using https
Tcl error [pub_FML]: can't read "a": no such variable |
|
| Back to top |
|
 |
|