WWW::Lengthen - lengthen 'shortened' urls


WWW-Lengthen documentation  | view source Contained in the WWW-Lengthen distribution.

Index


NAME

Top

WWW::Lengthen - lengthen 'shortened' urls

SYNOPSIS

Top

    use WWW::Lengthen;
    my $lenghtener = WWW::Lenghten->new;
    my $lengthened_url = $lengthener->try($url);

    # if you find some new and unsupported shortener service
    $lengthener->add( ServiceName => qr{^http://service.com/} );

    # or you may add some known extra services
    $lengthener->add( %WWW::Lengthen::ExtraServices );

DESCRIPTION

Top

There are a bunch of URL shortening services around the world. They have slightly different APIs to shorten URLs but the lengthening part is always the same: follow the shortened URL and see the redirect.

This module tries all the known services to find a longer URL. You may say we can do it with WWW::Shorten family but you can't say which services people use to shorten URLs. You can select some specific shortening service for your website to shorten longer URLs automatically, but spammers may post URLs shortened with other shortening services to avoid offensive URLs they post to be disclosed by clever client tools that know which shortening service your site uses.

Well, this is a cat and mouse game but I hope this help you a bit, at least to save time copying and pasting to create another WWW::Shorten subclass and load it just to lengthen URLs.

METHODS

Top

new

creates an object. Optionally you can pass an array of services to check if you want some more speed.

try

takes a (probably shortened) URL and find a longer URL. If not found, just returns the original URL.

add

takes a hash whose keys are service names and whose values are regexen to see if the tried URL should belong to the service or not. Preferably we should exclude API URLs but usually it doesn't matter as nothing would happen if we just GET them.

Several shorten services use special techniques to resolve links, such as multiple redirection or page refreshing. WWW::Lengthen doesn't support them natively at the moment, but if there's WWW::Shorten subclass, you can use it to lengthen like this:

  $self->add( Name => [ qr{^http://service.com/}, 'WWW::Shorten::ServiceName' ] );

ua

returns an LWP::UserAgent object used internally.

SUPPORTED SERVICES

Top

Natively

0rz (http://0rz.tw/)
haojp (http://hao.jp/)
Metamark (http://xrl.us/)
NotLong (http://notlong.com/)
Smallr (http://smallr.com/)
SnipURL (http://snipurl.com/)
TinyURL (http://tinyurl.com/)
Snurl (http://snurl.com/)
bit.ly (http://bit.ly/)
is.gd (http://is.gd/)

Require WWW::Shorten subclasses

Shorl (http://shorl.com/)

# Tinylink may not be available now as WWW::Shorten marks this as "dead"

Dead/Down/Too Heavy when I tested

not tested but probably works with WWW::Shorten subclasses.

I CAN HAZ dot COM (http://icanhaz.com/) (temporarily unavailable?)
urlTea (http://urltea.com/) (temporarily unavailable?)
BabyURL (http://babyurl.com/)
Linkz (http://lin.kz/)
TinyClick (http://tinyclick.com/)
V3 (http://www.v3.net/)
ShortenURL (http://www.shortenurl.com/)

SEE ALSO

Top

WWW::Shorten

AUTHOR

Top

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

Top


WWW-Lengthen documentation  | view source Contained in the WWW-Lengthen distribution.