duckduckgo / zeroclickinfo-spice

DuckDuckGo Instant Answers based on JavaScript (JSON) APIs
https://duckduckhack.com/
Other
548 stars 942 forks source link

DuckSay: Should set `is_unsafe` on|off based on presence of remainder #1307

Closed puskin94 closed 9 years ago

puskin94 commented 9 years ago

Searching for a new Spice idea, i found the spice "DuckSay". I tried it online and ( probably ) image search has the priority on the spice because on duckpan works great!! @moollaza do you remember the priority problem??

mattr555 commented 9 years ago

@puskin94 Are you trying it with !safeoff? The problem is that DuckSay takes a duck-related joke from /r/jokes, so it's something that we catch with the filter. @moollaza is it possible for the IA to change its is_unsafe flag based on the query?

puskin94 commented 9 years ago

@mattr555 no i tried simply searching "ducksay" in ddg like this https://duckduckgo.com/?q=ducksay but looking at your url ( adding &kp=-1 ) works fine!

moollaza commented 9 years ago

@mattr555 yes, actually it should be possible. You can use the same approach as the Forecast IA which return a hash along with the answer containing any update spice attributes:

https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Forecast.pm#L95

In this case, when the query contains a string from the user, we can consider it "safe".