/lib/DDG/Spice/Astrobin/Subject.pm

https://github.com/pardocz/zeroclickinfo-spice · Perl · 27 lines · 21 code · 5 blank · 1 comment · 2 complexity · 6b00e377f7f6b7d36beb910c02176317 MD5 · raw file

  1. package DDG::Spice::Astrobin::Subject;
  2. # ABSTRACT: Retrieve images based on subject.
  3. use DDG::Spice;
  4. name "Astrobin Subject";
  5. source "http://www.astrobin.com";
  6. description "Astrophotography images fetched by group search";
  7. primary_example_queries "astrophoto M31", "astronomy pictures saturn";
  8. category "special";
  9. topics "special_interest";
  10. icon_url "http://www.astrobin.com/favicon.ico";
  11. code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Astrobin/Subject.pm";
  12. attribution github => ["https://github.com/killerfish", "Usman Raza"],
  13. twitter => ["https://twitter.com/f1shie", "Usman Raza"];
  14. triggers start => "astrophoto", "astrophotography", "astronomy pictures", "astronomy picture", "astronomy picture of", "astronomy image of", "astronomy pictures of", "astronomy images of";
  15. spice to => 'http://www.astrobin.com/api/v1/image/?title__icontains=$1&api_key={{ENV{DDG_SPICE_ASTROBIN_APIKEY}}}&api_secret={{ENV{DDG_SPICE_ASTROBIN_APISECRET}}}&format=json';
  16. spice wrap_jsonp_callback => 1;
  17. handle remainder => sub {
  18. return if /(image|photo|picture)?s?\s*(of|of the)?\s*(day|today|daily)$/i;
  19. return $_ if $_;
  20. return;
  21. };
  22. 1;