PageRenderTime 38ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/DDG/Spice/Movie.pm

http://github.com/duckduckgo/zeroclickinfo-spice
Perl | 36 lines | 26 code | 7 blank | 3 comment | 0 complexity | 9ba450d40b24fc07e05e8fd57f441fec MD5 | raw file
Possible License(s): Apache-2.0
  1. package DDG::Spice::Movie;
  2. # ABSTRACT: Movie information from Rotten Tomatoes
  3. use strict;
  4. use DDG::Spice;
  5. spice proxy_cache_valid => "200 7d";
  6. spice to => 'http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey={{ENV{DDG_SPICE_ROTTEN_APIKEY}}}&q=$1&page_limit=50&page=1&callback={{callback}}';
  7. spice alt_to => {
  8. movie_image => {
  9. to => 'https://api.themoviedb.org/3/find/$1?api_key={{ENV{DDG_SPICE_MOVIEDB_APIKEY}}}&external_source=imdb_id',
  10. proxy_cache_valid => "200 30d"
  11. },
  12. cast_image => {
  13. to => 'https://api.themoviedb.org/3/search/person?query=$1&api_key={{ENV{DDG_SPICE_MOVIEDB_APIKEY}}}',
  14. proxy_cache_valid => "200 30d"
  15. }
  16. };
  17. # This spice will usually be triggered by deep triggers,
  18. # with a few extra triggers that deep might miss.
  19. my @triggers = ( 'rotten tomatoes', 'rotten', 'cast', 'casts', 'actor', 'actors', 'actress', 'actresses');
  20. my @triggers_start = ( 'cast of', 'casts of', 'who stars in', 'who starred in', 'actor in', 'actors in', 'actress in', 'actresses in' );
  21. my @triggers_end =( 'movie cast', 'movie casts');
  22. triggers start => @triggers_start;
  23. triggers end => @triggers_end;
  24. triggers startend => @triggers;
  25. handle remainder => sub {
  26. return unless $_;
  27. return $_;
  28. };
  29. 1;