/lib/DDG/Spice/Astrobin/Apod.pm

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

  1. package DDG::Spice::Astrobin::Apod;
  2. # ABSTRACT: Fetch Astronomy picture of day.
  3. use DDG::Spice;
  4. name "Apod";
  5. source "http://www.astrobin.com";
  6. description "Get astronomy image of day";
  7. primary_example_queries "astronomy picture of the day";
  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/Apod/Apod.pm";
  12. attribution github => ["https://github.com/killerfish", "Usman Raza"],
  13. twitter => ["https://twitter.com/f1shie", "Usman Raza"];
  14. triggers start => "astronomy", "astrophoto";
  15. spice to => 'http://www.astrobin.com/api/v1/imageoftheday/?limit=1&api_key={{ENV{DDG_SPICE_ASTROBIN_APIKEY}}}&api_secret={{ENV{DDG_SPICE_ASTROBIN_APISECRET}}}&format=json$1';
  16. spice proxy_cache_valid => "200 60m";
  17. spice wrap_jsonp_callback => 1;
  18. handle remainder => sub {
  19. return '' if /^((image|photo|picture)s?)?\s*(of|of the)?\s*(day|today|daily)$/i;
  20. return;
  21. };
  22. 1;