DuckDuckGo: add structured answer.
parent
42546f37d7
commit
130f1aa806
|
@ -67,7 +67,11 @@ handle remainder => sub {
|
|||
my $response = $responses->{$key};
|
||||
|
||||
return unless ($response);
|
||||
return $response->{text}, html => $response->{html};
|
||||
return $response->{text},
|
||||
structured_answer => {
|
||||
input => [],
|
||||
operation => 'DuckDuckGo info',
|
||||
result => $response->{html}};
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
@ -9,28 +9,64 @@ zci answer_type => 'duckduckgo';
|
|||
zci is_cached => 1;
|
||||
|
||||
# The results should be static, so these facilitate easier testing of triggers.
|
||||
my @about_result =
|
||||
("DuckDuckGo's about page: https://duckduckgo.com/about", html => "DuckDuckGo's <a href='https://duckduckgo.com/about'>about page</a>.");
|
||||
my @blog_result = ("DuckDuckGo's official blog: https://duck.co/blog", html => "DuckDuckGo's <a href='https://duck.co/blog'>official blog</a>.");
|
||||
my @help_result =
|
||||
("Need help? Visit our help page: http://dukgo.com/help/", html => "Need help? Visit our <a href='http://dukgo.com/help/'>help page</a>.");
|
||||
my @about_result = (
|
||||
"DuckDuckGo's about page: https://duckduckgo.com/about",
|
||||
structured_answer => {
|
||||
input => [],
|
||||
operation => 'DuckDuckGo info',
|
||||
result => "DuckDuckGo's <a href='https://duckduckgo.com/about'>about page</a>."
|
||||
});
|
||||
my @blog_result = (
|
||||
"DuckDuckGo's official blog: https://duck.co/blog",
|
||||
structured_answer => {
|
||||
input => [],
|
||||
operation => 'DuckDuckGo info',
|
||||
result => "DuckDuckGo's <a href='https://duck.co/blog'>official blog</a>."
|
||||
});
|
||||
my @help_result = (
|
||||
"Need help? Visit our help page: http://dukgo.com/help/",
|
||||
structured_answer => {
|
||||
input => [],
|
||||
operation => 'DuckDuckGo info',
|
||||
result => "Need help? Visit our <a href='http://dukgo.com/help/'>help page</a>."
|
||||
});
|
||||
my @irc_result = (
|
||||
"DuckDuckGo's official IRC channel is #duckduckgo on irc.freenode.net.",
|
||||
html =>
|
||||
"DuckDuckGo's official IRC channel is <a href='http://webchat.freenode.net/?channels=duckduckgo'>#duckduckgo</a> on <a href='http://freenode.net/'>irc.freenode.net</a>"
|
||||
);
|
||||
structured_answer => {
|
||||
input => [],
|
||||
operation => 'DuckDuckGo info',
|
||||
result =>
|
||||
"DuckDuckGo's official IRC channel is <a href='http://webchat.freenode.net/?channels=duckduckgo'>#duckduckgo</a> on <a href='http://freenode.net/'>irc.freenode.net</a>"
|
||||
});
|
||||
my @merch_result = (
|
||||
"Thanks for the support! Check out the DuckDuckGo store for t-shirts, stickers, and other items: https://duck.co/help/community/swag",
|
||||
html =>
|
||||
"Thanks for the support! Check out the <a href='https://duck.co/help/community/swag'>DuckDuckGo store</a> for t-shirts, stickers, and other items."
|
||||
);
|
||||
my @tor_result =
|
||||
("DuckDuckGo's service on Tor: http://3g2upl4pq6kufc4m.onion", html => "DuckDuckGo's <a href='http://3g2upl4pq6kufc4m.onion'>service on Tor</a>.");
|
||||
my @shorturl_result = ("DuckDuckGo's short URL: http://ddg.gg/", html => "DuckDuckGo's short URL: <a href='http://ddg.gg/'>http://ddg.gg/</a>.");
|
||||
structured_answer => {
|
||||
input => [],
|
||||
operation => 'DuckDuckGo info',
|
||||
result =>
|
||||
"Thanks for the support! Check out the <a href='https://duck.co/help/community/swag'>DuckDuckGo store</a> for t-shirts, stickers, and other items."
|
||||
});
|
||||
my @tor_result = (
|
||||
"DuckDuckGo's service on Tor: http://3g2upl4pq6kufc4m.onion",
|
||||
structured_answer => {
|
||||
input => [],
|
||||
operation => 'DuckDuckGo info',
|
||||
result => "DuckDuckGo's <a href='http://3g2upl4pq6kufc4m.onion'>service on Tor</a>."
|
||||
});
|
||||
my @shorturl_result = (
|
||||
"DuckDuckGo's short URL: http://ddg.gg/",
|
||||
structured_answer => {
|
||||
input => [],
|
||||
operation => 'DuckDuckGo info',
|
||||
result => "DuckDuckGo's short URL: <a href='http://ddg.gg/'>http://ddg.gg/</a>."
|
||||
});
|
||||
my @zci_result = (
|
||||
"Zero Click Info is the term DuckDuckGo uses for these boxes, which often provide useful instant answers above traditional results.",
|
||||
html => "Zero Click Info is the term DuckDuckGo uses for these boxes, which often provide useful instant answers above traditional results."
|
||||
);
|
||||
structured_answer => {
|
||||
input => [],
|
||||
operation => 'DuckDuckGo info',
|
||||
result => "Zero Click Info is the term DuckDuckGo uses for these boxes, which often provide useful instant answers above traditional results."
|
||||
});
|
||||
|
||||
ddg_goodie_test(
|
||||
[qw( DDG::Goodie::DuckDuckGo )],
|
||||
|
|
Loading…
Reference in New Issue