/lib/DDG/Spice/WGHA.pm

https://github.com/pardocz/zeroclickinfo-spice · Perl · 34 lines · 24 code · 9 blank · 1 comment · 2 complexity · 951517f2af077516cd11ec569ca053b3 MD5 · raw file

  1. use utf8;
  2. package DDG::Spice::WGHA;
  3. # ABSTRACT: Search for events on was geht heute ab.de.
  4. use DDG::Spice;
  5. primary_example_queries "was geht in frankfurt";
  6. secondary_example_queries "wasgeht in berlin";
  7. description "Events in Germany";
  8. name "WGHA Events";
  9. code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/WGHA.pm";
  10. topics "entertainment", "special_interest";
  11. category "entertainment";
  12. attribution web => ['http://www.wasgehtheuteab.de','Samuel Goebert'],
  13. email => ['http://www.wasgehtheuteab.de','Samuel Goebert'];
  14. my @triggers = ("was geht", "wasgeht", "aus gehen", "ausgehen", "nachtleben" );
  15. triggers any => @triggers;
  16. spice to => 'http://ddg.wasgehtheuteab.de/duckduckgo/events.json?q=$1&callback={{callback}}&api_key={{ENV{DDG_SPICE_WGHA_APIKEY}}}';
  17. spice proxy_cache_valid => "200 60m";
  18. handle query_lc => sub {
  19. return $_ if $loc->country_code eq 'DE';
  20. if ($_ =~ /berlin|darmstadt|dresden|düsseldorf|duesseldorf|frankfurt|freiburg|hamburg|hannover|kassel|köln|koeln|leipzig|mainz|mannheim|münchen|muenchen|stuttgart/) {
  21. return $_;
  22. }
  23. return;
  24. };
  25. 1;