PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/DDG/Spice/Shorten.pm

https://github.com/robertbrook/zeroclickinfo-spice
Perl | 28 lines | 21 code | 6 blank | 1 comment | 1 complexity | 686f546a194abd02759f48966621370c MD5 | raw file
  1. package DDG::Spice::Shorten;
  2. # ABSTRACT: Return a shortened version of a URL using the bitly API.
  3. use DDG::Spice;
  4. primary_example_queries "shorten http://www.duckduckgo.com/about.html";
  5. secondary_example_queries "url shorten www.github.com/explore";
  6. description "Shorten URLs using the is.gd API";
  7. name "Shorten";
  8. icon_url "/i/is.gd.ico";
  9. source "Shorten";
  10. code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Shorten.pm";
  11. topics "social";
  12. category "computing_tools";
  13. attribution github => ['https://github.com/danjarvis','Dan Jarvis'],
  14. twitter => ['http://twitter.com/danjarvis','danjarvis'];
  15. spice to => 'http://is.gd/create.php?format=json&url=$1&callback={{callback}}';
  16. triggers any => 'shorten', 'shorten url', 'short url', 'url shorten';
  17. handle remainder => sub {
  18. my ($longUri) = shift;
  19. return $longUri if $longUri;
  20. return;
  21. };
  22. 1;