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.
Help for those learning Tcl or writing their own scripts.
NewzNZ
Halfop
Posts: 68 Joined: Thu Mar 05, 2009 5:15 am
Contact:
Post
by NewzNZ » Sat Jul 30, 2022 7:58 pm
Hi there
I had been running a script to use v.gd and is.gd for delivering shortened urls of news stories to a channel...but lately has been returning nothing despite the sites appearing to still be working.
Was wondering if anyone has had experience using these sites in scripts? Currently the only other shortener site I've been able to use sucessfully is tinyurl but would prefer the reduced length of the first 2 mentioned.
Thanks in advance for any help!
CrazyCat
Revered One
Posts: 1296 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Sun Jul 31, 2022 8:12 am
Can you provide your scripts so we can test and look for an explanation and/or a solution
NewzNZ
Halfop
Posts: 68 Joined: Thu Mar 05, 2009 5:15 am
Contact:
Post
by NewzNZ » Sun Aug 28, 2022 12:27 am
Thanks & apologies for the spectacularly slow reply:
Code: Select all
set query [::http::geturl http://v.gd/create.php?url=$somelongurltoshorten&format=simple]
set url [lindex [split [::http::data $query] \n] 0]
putserv "PRIVMSG $channel :$url"
Thanks again!
CrazyCat
Revered One
Posts: 1296 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Mon Aug 29, 2022 10:09 am
v.gd now uses https, so you need the tls package and modify the script like this:
Code: Select all
::http::register https 443 [list ::tls::socket -autoservername true]
set query [::http::geturl https://v.gd/create.php?url=$somelongurltoshorten&format=simple]
set url [lindex [split [::http::data $query] \n] 0]
::http::cleanup $query
::http::unregister https
putserv "PRIVMSG $channel :$url"
NewzNZ
Halfop
Posts: 68 Joined: Thu Mar 05, 2009 5:15 am
Contact:
Post
by NewzNZ » Mon Aug 29, 2022 5:23 pm
Thanks for this - looks like perhaps my shell provider dosn't have the needed items as it's still returning an empty url...
Thanks anyway.
CrazyCat
Revered One
Posts: 1296 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Mon Aug 29, 2022 6:34 pm
did you add package require tls after the package require http line in your script ?
NewzNZ
Halfop
Posts: 68 Joined: Thu Mar 05, 2009 5:15 am
Contact:
Post
by NewzNZ » Mon Aug 29, 2022 7:12 pm
added to top of script:
package require http
package require tls
but bot quit with this error when rehashed:
Tcl error in file 'i.conf':
can't find package tls
while executing
"package require tls"
NewzNZ
Halfop
Posts: 68 Joined: Thu Mar 05, 2009 5:15 am
Contact:
Post
by NewzNZ » Mon Aug 29, 2022 8:35 pm
ps not sure if it helps but the script I use for tinyurl is:
Code: Select all
set query [::http::geturl http://tinyurl.com/api-create.php?url=$someurl]
set url [lindex [split [::http::data $query] \n] 0]
...and it seems to work without the https even though tinyurl is also an https site?
CrazyCat
Revered One
Posts: 1296 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Tue Aug 30, 2022 4:23 am
Ok, so you upgrade your tcl version, or ask your hoster to upgrade it, as tls is in tcl since version 8.4.
And tinyurl allows the non-https queries when v.gd forces the https usage (tested and verified)
NewzNZ
Halfop
Posts: 68 Joined: Thu Mar 05, 2009 5:15 am
Contact:
Post
by NewzNZ » Tue Aug 30, 2022 5:16 pm
Thanks...will send them a message.
Appreciate the help!