; Shorten URLS with dft.ba /* alias dftba { if ($1 == -e) { var %dft.ba.out echo -gsa $str($chr(160),3) } elseif ($1 == -p) { var %dft.ba.out say $str($chr(160),3) } if (!$2) { halt } else { var %dft.ba $getsource(http://dft.ba/api/shorten.json?DATA_IN_GET=1&TARGET_URL= $+ $2) if ($remove($gettok(%dft.ba,23,34),:,$chr(44)) < 5) { %dft.ba.out --> Error: approaching API limit of 100 per hour. $gettok(%dft.ba,22,34) calls left. Try again later. %dft.ba.out --> Why not take a break from dft.ba and use bit.ly } elseif ($remove($gettok(%dft.ba,23,34),:,$chr(44)) >= 5) { %dft.ba.out $2 --> http://dft.ba/ $+ $gettok(%dft.ba,12,34) echo -s $remove($gettok(%dft.ba,23,34),$chr(44),:) API calls left (Limit 100 API calls per hour). echo -gs $gettok(%dft.ba,16,34) } } } alias testdftba { var %test $getsource(http://dft.ba/api//expand.json?DATA_IN_GET=1&SHORT_URL= $+ $1) echo -gs %test } */ alias dftba { var %sckid = $right($ticks,5) set %way. [ $+ [ %sckid ] ] echo 14 -ga set %query. [ $+ [ %sckid ] ] $1 set %custom. [ $+ [ %sckid ] ] $2 sockopen dftbashorten. [ $+ [ %sckid ] ] dft.ba 80 } on *:SOCKOPEN:dftbashorten.*: { sockwrite -nt $sockname GET /api/shorten?src= $+ %custom. [ $+ [ $right($sockname,5) ] ] $+ &target= $+ %query. [ $+ [ $right($sockname,5) ] ] HTTP/1.1 sockwrite -nt $sockname Host: dft.ba sockwrite -nt $sockname $crlf } on *:SOCKREAD:dftbashorten.*: { if ($sockerr) { %way. [ $+ [ $right($sockname,5) ] ] Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message. halt } else { var %sockreader sockread %sockreader if (*complete_url* iswm %sockreader) { noop $regex(%sockreader,/(.*?)<\/span>/Si) var %tempvar $regml(1) %way. [ $+ [ $right($sockname,5) ] ] %tempvar .clipboard %tempvar unset %*. [ $+ [ $right($sockname,5) ] ] sockclose $sockname } } }