PageRenderTime 31ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/DDG/Spice/WGHA.pm

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