View previous topic :: View next topic |
Author |
Message |
NewzNZ Halfop

Joined: 05 Mar 2009 Posts: 64
|
Posted: Sat Jul 30, 2022 7:58 pm Post subject: url shortener |
|
|
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! |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1108 Location: France
|
|
Back to top |
|
 |
NewzNZ Halfop

Joined: 05 Mar 2009 Posts: 64
|
Posted: Sun Aug 28, 2022 12:27 am Post subject: |
|
|
Thanks & apologies for the spectacularly slow reply:
Code: | 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! |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1108 Location: France
|
Posted: Mon Aug 29, 2022 10:09 am Post subject: |
|
|
v.gd now uses https, so you need the tls package and modify the script like this:
Code: | ::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" |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
NewzNZ Halfop

Joined: 05 Mar 2009 Posts: 64
|
Posted: Mon Aug 29, 2022 5:23 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1108 Location: France
|
|
Back to top |
|
 |
NewzNZ Halfop

Joined: 05 Mar 2009 Posts: 64
|
Posted: Mon Aug 29, 2022 7:12 pm Post subject: |
|
|
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" |
|
Back to top |
|
 |
NewzNZ Halfop

Joined: 05 Mar 2009 Posts: 64
|
Posted: Mon Aug 29, 2022 8:35 pm Post subject: |
|
|
ps not sure if it helps but the script I use for tinyurl is:
Code: |
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? |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1108 Location: France
|
Posted: Tue Aug 30, 2022 4:23 am Post subject: |
|
|
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) _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
NewzNZ Halfop

Joined: 05 Mar 2009 Posts: 64
|
Posted: Tue Aug 30, 2022 5:16 pm Post subject: |
|
|
Thanks...will send them a message.
Appreciate the help! |
|
Back to top |
|
 |
|