duckduckgo / zeroclickinfo-spice Goto Github PK
View Code? Open in Web Editor NEWDuckDuckGo Instant Answers based on JavaScript (JSON) APIs
Home Page: https://duckduckhack.com/
License: Other
DuckDuckGo Instant Answers based on JavaScript (JSON) APIs
Home Page: https://duckduckhack.com/
License: Other
DDG can tell you your flash version but it doesn't give you the last 3 numbers:
Example: On DDG: "Your Flash Player version: 11.1.102 More at Adobe".
Full version: "11.1.102.62"
Also, it would be useful to have the version table available on Adobe at: http://kb2.adobe.com/cps/155/tn_15507.html
Randall often writes comics that relate closely to the US cultural background, difficult to grasp for non-US folks. That's why the website http://www.explainxkcd.com popped up.
Would it be possible to obtain the explainations above for the XKCD zero-click search? I suggest to add a button like "didn't get the catch?" so that the explaination is optional, but still available.
Cheers,
When you search for the definition of a plural word, it only shows the singular form of the word and doesn't provide its definition:
https://duckduckgo.com/?q=define+chakras
https://duckduckgo.com/?q=define+vicissitudes
I suggest that the singular form definition is shown just below it (or include a button to re-query for the singular form).
Something like this, only with way less clutter :) http://imgur.com/wCmaAy9
Noticed that Reddit only allows subreddit <term>
and not <term> subreddit
, for the simple ones we should make sure you can trigger the spice either way.
https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/RedditSubSearch.pm
Really we should move as many spice plugins as we can over to "word triggers" and use a regex to qualify them. Hence we no longer have this issue.
@moollaza, if I type in the query "ne555 datasheet" or "ne555 octopart," three different plugins get triggered (oddly enough, when I type in "ne555 specs" only two plugins get triggered).
Here is a screenshot (notice the three spice.js files loaded):
One is the latest version of Octopart, an old version of Octopart, and Zipcode. Why does this happen?
I've seen a ton of malformatted URLs in logs coming from DDG plugin for zanran.
I thought it might be an error in the plugin, but it doesn't seem so.
When I search for:
saudi arabia "oil production"
with duckpan server, this apparently correct URL gets generated:
GET /search/simple_json?callback=ddg_spice_zanran&q=saudi%20arabia%20%22oil%20production%22
HTTP/1.1
then zanran API returns correct result, and everything works.
But the same search on duckduckgo.com generates this:
GET /search/simple_json?callback=ddg_spice_zanran&q=saudi%20arabia%20"oil%20production"
HTTP/1.0
With nothing except spaces escaped, and server returns error due to
malformatted URL.
I think any query with weird characters like quotation marks in it is
likely to be affected.
It's not a big deal since it's presumably only a tiny fraction of all queries,
but it might affect other plugins as well, and it's probably pretty
simple to fix.
Or as a workaround zanran plugin's spice.js could just replace most punctuation
with spaces before sending API request instead of after.
(zanran API tries to handle punctuation semi-intelligently replacing & with and,
stripping 's etc., but it probably doesn't matter all that much,
it's just a series of preprocessing regexps).
As requested in the README, I wanted to let everyone know that I'm working on a DDG spice plugin for yipp.it. It will display the latest news article that yipp.it has pertaining to the search. (e.x. Someone searches "greece news". The plugin will return the newest article that yipp.it has that pertains to Greece.)
I will start a pull request for the code when I'm done with it.
Why doesn't this work?
Looks like safesearch doesn't hit wordnik's (sometimes questionable) output at all: https://duckduckgo.com/?q=define%20fu&kp=1&kl=wt-wt
Eg. https://duckduckgo.com/?q=movie+test
Noticed that the release date for this movie comes through as "(undefined)". This should be fixed.
This should be fixed, a proper test needs to be written for SearchCode.
https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/CodeSearch.pm
I just realized a bug that has crept into this. The "lang:" should prefix the language words.
EG.
code python foreach TO lang:python foreach
code php $this-> TO $this-> lang:php
code goto TO goto lang:perl
As it is you end up with queries like,
code foreach TO lang:foreach
Which returns nothing useful at all, as the lang syntax is trying to restrict to the langage "foreach" which is nonsensical. The syntax is copied from the original google code search. http://en.wikipedia.org/wiki/Google_Code_Search
Noticed when going through some logs. An example that's on the live site would be,
Search for 19460, click on French zip code.
Plugins that use trigger words are significantly more efficient. We should really move over as many "regex" plugins as possible (especially those that have use a specific trigger word) to rather trigger initially on that word and in the handle statement use a regex to disqualify any inappropriate searches.
If you look at something like https://duckduckgo.com/?q=github+weather or https://duckduckgo.com/?q=github+zeroclickinfo
They have a lot of duplicates (due to forks) and some that have no descriptions (due to not being there I suppose).
Is there a way to either filter these out and default to the main ones or sort them so the main ones are at the top and the forks/ones with less info are at the bottom? Also, we could include the name of the person/group to make things not duplicate.
There should be commas between the "similar postal codes": https://duckduckgo.com/?q=19301
It appears the query duckpan wants to submit queries via https but only http is allowed and configured to be used by the server.
Manual entry in the address bar of queries works with http but https
FYI
Certain things are missing such as error checking. The spice should really meet the canonical plugin format.
At the moment I notice that ddg is faking a browsers user agent on zeroclick api requests.
Specifically, I get:
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.127 Safari/534.16
Is there a reason to not be providing a better user agent that describes what is actually making the request?
We could use last.fm's API to display information when users type Maroon 5 albums
. The albums could be displayed as a row of images similar to the alternative to plugin. I can apply for an API account (http://www.last.fm/api/account) but I'm not quite sure if I should choose Commercial or Non-commercial use.
I look forward to getting your feedback!
Currently IMDb Tom Hanks returns movie info (as opposed to the actor). I understand why -- because we're using a third-party API that only looks up movies, but it is a poor experience.
Perhaps we can expose some internal name detection for this piece.
Query: https://duckduckgo.com/?q=asus+rt-66nu
Need to make sure the "rt" trigger looks for word boundaries eg. qr/ \b rt \b/x
Example: https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Canistreamit.pm
This plugin handles the remainder but doesn't check to make sure the remainder is defined or non empty. It should really make sure of this so that a search for "Streaming" does hit their endpoint with nothing.
Searching hn best blogging platform surprisingly gives no results.
However searching hn blogging platform gives results.
There seems to be a java script error in the first search due to a missing value in the json which has no check to make sure it exists!
It seems most "comments" have a discussion attribute which also have the title of the thread being commented on. However the second comment result from the first search is missing the discussion attribute.
Clearly a check is missing for the "discussion" attribute.
There are probably a lot of triggers we can add to these spices such as:
release date
runtime | length | hours | how long is
cast of
actors in
plot | premise | synopsis | overview | summary
The other issue is that we need to make sure the api's will return the relevant information. Otherwise we need to seek out a better, more robust movie api (or separate movie API's) which can provide the best answers for these kinds of queries.
Would be a nice addition to the ZipCode spice
@boyter a DDG search for "IOS 6" returns a really irrelevant result...
Have a look: https://duckduckgo.com/?q=iOS+6 -- any thoughts?
EDIT: Sorry I though the problem was the relevancy of the result, clearly its not irrelevant it relevant to IOS, but the issue is that it looks like the "6" might not be being used correctly in the DDG.is_Relevant function because it looks like its being captured in the date " 6 January 1965". The context of the 6 in the result is incorrect. Perhaps we need to do a check for digits after the mention of certain terms because they might be version numbers?
Would there be any results that would have "IOS 6" in the title?
Are we against using Google Translate's API for the translator request?
Was playing around and noticed the following issue,
A search for the following
code c++ test
code c# test
Actually ends up pulling back results for "c"
The issue appears to be in the following piece of code,
if ($_ =~ m/$words/i) {
$_ =~ s/$words//i;
return "lang:".$1." ".$_;
}
It would appear that when it triggers on "code c# test" when it returns the following,
lang%3Ac%20%23%20test
which of course is
lang:c # test
Hence the issue, as it should be
lang:c# test
Had a go fixing this, but I literally know zero Perl and couldn't resolve it so thought I would throw the issue in here.
From feedback
Lookup: 21835 on Google, then on DuckDuckGo.
Google simply brings back the relevant result:
Linkwood, MD 21835
DuckDuckGo returns Dorchester County which is a much bigger area.
I often enter postcodes without a space "ox13dr", rather than say "ox1 3dr". In the United Kingdom, there is no ambiguity in missing the space, and people often do that when typing them for searches.
The MapQuest map is triggered when I include the space, not triggered when I don't.
In the Zipcode.pm spice, there are a bunch of quite generic regular expressions which I don't understand the international implications of in full to offer a patch.
Windows 7 x64
IE9
Chrome 24.0.1312.52 m
Trigger text "ios 6" https://duckduckgo.com/?q=ios+6
Encountered the following error, for IE9. Searching for ios 6 https://duckduckgo.com/?q=ios+6 triggers the below.
Line: 1
Error: 'ddg_spice_search_code' is undefined
ddg_spice_search_code({"results":[{"name":"dateFromComponents:","namespace":"NSCalendar.dateFromComponents:","url":"http:///developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/ReferenceNSCalendar.html#//apple_ref/occ/instm/NSCalendar/dateFromComponents:","description":"Returns a new NSDate object representing the absolute time calculated from given components. When there are insufficient components provided to completely specify an absolute time, a calendar uses default values of its choice. When there is inconsistent information, a calendar may ignore some of the components parameters or the method may return nil. Unnecessary components are ignored (for example, Day takes precedence over Weekday and Weekday ordinals). The following example shows how to use this method to create a date object to represent 14:10:00 on 6 January 1965, for a given calendar (gregorian). Note that some computations can take a relatively long time to perform. Available in iOS 2.0 and later.","synopsis":"(NSDate *)dateFromComponents:(NSDateComponents *)comps","type":"appleios","icon":"apple.ico","displayname":"Mac iOS Reference","modeltype":"function","rank":9}],"page":0,"total":"1","searchterm":"ios 6","query":"ios 6","matchterm":"ios 6","cleanterm":"","generalregex":"","regex":"","nextpage":1,"previouspage":null})
If you step through the spice code it renders as expected. Rerun and its call cached so no issues there. Clear cache and rerun you can repeat the above.
db.tt
me.lt
@yegg
A event reccommender system (initial for sxsw but portable to other events)
idea: identify musical talent events at south by south west that might fit a description or be similar in style to well known bands across all genres
3rd parties Leveraged:
e.g.
sxsw kindalike the beatles
sxsw kindalike metallica tonight
* gives results for events that might match that night
sxsw kindalike Al Jarreau cool now
* gives results that might be similar to Al Jarreau
* narrows results to (hot/cool) based on recent geo activity via twitter and 4square
Yes its a rush job but I think it could be a mutually beneficial project for DDG and any of the active devs interested
Will start with enough interest from core DDG
https://duckduckgo.com/?q=imdb+the+dark+knight
It seems that IMDB is now blocking requests to their assets...we might have to get rid of the images all together, or get them from the rotten tomatoes API.
https://duckduckgo.com/?q=sdfsdf
^^Clicking the link generated as an instant answer results in a 404'd page.
e.g. query: map 19460
Seeing as IMDB is blocking our IP, we might as well remove the images for now. They broken image icon looks bad...
From feedback:
Currently you type Genesis 1:2 to get "Zero-click Info sources". This could be more useful if it also works with Bible abbreviations, e.g., gen 1:2 for Genesis 1:2, phil for Philippians, etc.
I have noticed that DDG uses WA as a major source for zero click info. How do you tell it to call WA on some trigger? For example, I have found that the query "zipcode 12345" is best served by the information from WA. Since I presume DDG already has an easy to call WA on some triggers, I think it is better if it is added to that list instead of creating a new spice that essentially does the same thing.
Just realized that Twitter is using a regex and only matches very specific queries. We should really switch it to a word trigger so it triggers on "@".
If this change is made the DuckDuckHack documentation will also need to be updated accordingly.
We should also probably make a twitter search spice so "twitter Zaahir Moolla" would search for users with that name and return a list of possible matches (similar to Google+)
I'm not sure if all that's possible but it would be nice.
There are other similar plugins such as Search_Code and Code_Search which should also be switched over to use word triggers because they are considerably faster and less taxing on the backend.
Also, we should add a little logic to make sure the trigger word isn't the entire query. This would also be made easier if we use trigger words.
A nice solution for creating the trigger words would be to slurp a text file and create a word trigger from each line, similar to the airlines plugin. It would at least look a littler nice than having a massively wide/tall list of words.
Also, it should be able to trigger on the word "Zanran".
in the metadata
If someone tries searching "oblivion movie info" currently it triggers on "movie" and searches for "oblivion info" on Rotten Tomates which fails.
Some folks (myself included) are curious if we can use DDG preferences to default searches to !g to utilize the non tracking features with google search results. If so, can this option be made more obvious and if not can this become a feature?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.