Advertisement
swarley

XChat is.gd use with /shorten <url>

Nov 1st, 2011
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.44 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3. use LWP::Simple;
  4. use Xchat ':all';
  5.  
  6. Xchat::hook_command('shorten', 'get_url');
  7.  
  8. sub get_url {
  9.     my $url = $_[1][1];
  10.     my $miniurl = get("http://is.gd/create.php?format=simple&url=" . $url);
  11.     my $page = "NIL"; $page = get($url);
  12.     $page =~ /\<title\>(.+?)\<\/title>/;
  13.     if ($1) {
  14.         Xchat::command("SAY $miniurl #{ " . $1 . " }");
  15.    } else {
  16.         Xchat::command("SAY $miniurl");
  17.    }
  18. }
  19.  
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement