{"action":"created","comment":{"url":"https://api.github.com/repos/jarun/ddgr/pulls/comments/233047819","pull_request_review_id":174375099,"id":233047819,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzA0NzgxOQ==","diff_hunk":"@@ -1245,21 +1374,25 @@ class DdgCmd(object):\n         else:\n             results = self.results\n \n+        if self.index == 0 and self.instant_answer is not None:\n+            answer = Result(0, 'Instant Answer', 'https://duckduckgo.com/api', self.instant_answer)","path":"ddgr","position":169,"original_position":169,"commit_id":"c4826312834de8cdb58278d415ac6b0cc9b54e06","original_commit_id":"c4826312834de8cdb58278d415ac6b0cc9b54e06","user":{"login":"jarun","id":5959286,"node_id":"MDQ6VXNlcjU5NTkyODY=","avatar_url":"https://avatars3.githubusercontent.com/u/5959286?v=4","gravatar_id":"","url":"https://api.github.com/users/jarun","html_url":"https://github.com/jarun","followers_url":"https://api.github.com/users/jarun/followers","following_url":"https://api.github.com/users/jarun/following{/other_user}","gists_url":"https://api.github.com/users/jarun/gists{/gist_id}","starred_url":"https://api.github.com/users/jarun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarun/subscriptions","organizations_url":"https://api.github.com/users/jarun/orgs","repos_url":"https://api.github.com/users/jarun/repos","events_url":"https://api.github.com/users/jarun/events{/privacy}","received_events_url":"https://api.github.com/users/jarun/received_events","type":"User","site_admin":false},"body":"Use the value of abstract from Colors:\r\n\r\n    ln 1077: Colors = collections.namedtuple('Colors', 'index, title, url, metadata, abstract, prompt, reset')","created_at":"2018-11-13T14:00:47Z","updated_at":"2018-11-13T14:00:53Z","html_url":"https://github.com/jarun/ddgr/pull/70#discussion_r233047819","pull_request_url":"https://api.github.com/repos/jarun/ddgr/pulls/70","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/jarun/ddgr/pulls/comments/233047819"},"html":{"href":"https://github.com/jarun/ddgr/pull/70#discussion_r233047819"},"pull_request":{"href":"https://api.github.com/repos/jarun/ddgr/pulls/70"}},"in_reply_to_id":233036663},"pull_request":{"url":"https://api.github.com/repos/jarun/ddgr/pulls/70","id":222613614,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyNjEzNjE0","html_url":"https://github.com/jarun/ddgr/pull/70","diff_url":"https://github.com/jarun/ddgr/pull/70.diff","patch_url":"https://github.com/jarun/ddgr/pull/70.patch","issue_url":"https://api.github.com/repos/jarun/ddgr/issues/70","number":70,"state":"open","locked":false,"title":"Adding support for instant answer","user":{"login":"dstjacques","id":735244,"node_id":"MDQ6VXNlcjczNTI0NA==","avatar_url":"https://avatars0.githubusercontent.com/u/735244?v=4","gravatar_id":"","url":"https://api.github.com/users/dstjacques","html_url":"https://github.com/dstjacques","followers_url":"https://api.github.com/users/dstjacques/followers","following_url":"https://api.github.com/users/dstjacques/following{/other_user}","gists_url":"https://api.github.com/users/dstjacques/gists{/gist_id}","starred_url":"https://api.github.com/users/dstjacques/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dstjacques/subscriptions","organizations_url":"https://api.github.com/users/dstjacques/orgs","repos_url":"https://api.github.com/users/dstjacques/repos","events_url":"https://api.github.com/users/dstjacques/events{/privacy}","received_events_url":"https://api.github.com/users/dstjacques/received_events","type":"User","site_admin":false},"body":"## Summary\r\nThis adds an instant answer at index 0 of the initial search results page by default. The instant answer is not counting towards the number of results requested on the initial page (-n) if specified.\r\n\r\nThere is an option to disable instant answer. That could be changed to disable by default and have the option enable it but I thought the feature might be discovered less in that way.\r\n\r\nHopefully this is helpful as a starting point even if changes are desired in functionality and/or implementation. Open to any feedback here!\r\n\r\n## What works\r\n- Instant answers that consist of only text and that are returned by the DDG API without using a browser that runs JavaScript.\r\nExamples queries:\r\n`time now`\r\n`sha3 test`\r\n`days between 10/11/2018 and 2/18/2019`\r\n`random 1 100`\r\n`time in PST`\r\n\r\n#### Example command:\r\n`./ddgr sha3 test -n 2`\r\n\r\n#### Example output:\r\n```\r\n\r\n (0) Instant Answer  [duckduckgo.com]\r\n9ece086e9bac491fac5c1d1046ca11d737b92a2b2ebd93f005d7b710110c0a678288166e7fbe796\r\n883a4f2e9b3ca9f484f521d0ce464345cc1aec96779149c14\r\n \r\n (1) Test vectors for SHA-1, SHA-2 and SHA-3 - di-mgt.com.au  [www.di-mgt.com.au]\r\nDI Management Home > Cryptography > Test vectors for SHA-1, SHA-2 and SHA-3\r\nThis page summarises useful test vectors for the secure hash algorithms SHA-1,\r\nSHA-2 and the new SHA-3 (approved as a FIPS standard in August 2015 [ 6 ]).\r\n\r\n (2) SHA-3 - Wikipedia  [en.wikipedia.org]\r\nSHA-3 (Secure Hash Algorithm 3) is the latest member of the Secure Hash\r\nAlgorithm family of standards, released by NIST on August 5, 2015. Although\r\npart of the same series of standards, SHA-3 is internally quite different from\r\nthe MD5-like structure of SHA-1 and SHA-2.\r\n```\r\n\r\n## What doesn't work (well)\r\n- Instant answers that contain more complex formatting (tables, charts, etc.)\r\nExample queries:\r\n`ascii cheat sheet` - This unfortunately will just show result text of \"Cheat Sheet\" since that's all the API returns. The actual DDG results include a complex table showing ascii codes and their characters.\r\n\r\n- Instant answers that are not returned by the DDG API. These instant answers are added dynamically to the search results page via JavaScript.\r\nExample queries:\r\n`time in london` - This won't work since it's loaded dynamically using JS (however this instant answer was referenced in #68 which gave me the idea to try supporting this)\r\n\r\n## References\r\n- [Instant Answer API](https://duckduckgo.com/api)\r\n- [Instant Answers Index](https://duck.co/ia)\r\n- [Duck Duck Go Results](https://duckduckgo.com)\r\n","created_at":"2018-10-13T00:07:53Z","updated_at":"2018-11-13T14:00:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e552fec9474bac3ae7ca503df6ed9426bb98378a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/jarun/ddgr/pulls/70/commits","review_comments_url":"https://api.github.com/repos/jarun/ddgr/pulls/70/comments","review_comment_url":"https://api.github.com/repos/jarun/ddgr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jarun/ddgr/issues/70/comments","statuses_url":"https://api.github.com/repos/jarun/ddgr/statuses/c4826312834de8cdb58278d415ac6b0cc9b54e06","head":{"label":"dstjacques:master","ref":"master","sha":"c4826312834de8cdb58278d415ac6b0cc9b54e06","user":{"login":"dstjacques","id":735244,"node_id":"MDQ6VXNlcjczNTI0NA==","avatar_url":"https://avatars0.githubusercontent.com/u/735244?v=4","gravatar_id":"","url":"https://api.github.com/users/dstjacques","html_url":"https://github.com/dstjacques","followers_url":"https://api.github.com/users/dstjacques/followers","following_url":"https://api.github.com/users/dstjacques/following{/other_user}","gists_url":"https://api.github.com/users/dstjacques/gists{/gist_id}","starred_url":"https://api.github.com/users/dstjacques/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dstjacques/subscriptions","organizations_url":"https://api.github.com/users/dstjacques/orgs","repos_url":"https://api.github.com/users/dstjacques/repos","events_url":"https://api.github.com/users/dstjacques/events{/privacy}","received_events_url":"https://api.github.com/users/dstjacques/received_events","type":"User","site_admin":false},"repo":{"id":152672840,"node_id":"MDEwOlJlcG9zaXRvcnkxNTI2NzI4NDA=","name":"ddgr","full_name":"dstjacques/ddgr","private":false,"owner":{"login":"dstjacques","id":735244,"node_id":"MDQ6VXNlcjczNTI0NA==","avatar_url":"https://avatars0.githubusercontent.com/u/735244?v=4","gravatar_id":"","url":"https://api.github.com/users/dstjacques","html_url":"https://github.com/dstjacques","followers_url":"https://api.github.com/users/dstjacques/followers","following_url":"https://api.github.com/users/dstjacques/following{/other_user}","gists_url":"https://api.github.com/users/dstjacques/gists{/gist_id}","starred_url":"https://api.github.com/users/dstjacques/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dstjacques/subscriptions","organizations_url":"https://api.github.com/users/dstjacques/orgs","repos_url":"https://api.github.com/users/dstjacques/repos","events_url":"https://api.github.com/users/dstjacques/events{/privacy}","received_events_url":"https://api.github.com/users/dstjacques/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dstjacques/ddgr","description":":duck: DuckDuckGo from the terminal","fork":true,"url":"https://api.github.com/repos/dstjacques/ddgr","forks_url":"https://api.github.com/repos/dstjacques/ddgr/forks","keys_url":"https://api.github.com/repos/dstjacques/ddgr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dstjacques/ddgr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dstjacques/ddgr/teams","hooks_url":"https://api.github.com/repos/dstjacques/ddgr/hooks","issue_events_url":"https://api.github.com/repos/dstjacques/ddgr/issues/events{/number}","events_url":"https://api.github.com/repos/dstjacques/ddgr/events","assignees_url":"https://api.github.com/repos/dstjacques/ddgr/assignees{/user}","branches_url":"https://api.github.com/repos/dstjacques/ddgr/branches{/branch}","tags_url":"https://api.github.com/repos/dstjacques/ddgr/tags","blobs_url":"https://api.github.com/repos/dstjacques/ddgr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dstjacques/ddgr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dstjacques/ddgr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dstjacques/ddgr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dstjacques/ddgr/statuses/{sha}","languages_url":"https://api.github.com/repos/dstjacques/ddgr/languages","stargazers_url":"https://api.github.com/repos/dstjacques/ddgr/stargazers","contributors_url":"https://api.github.com/repos/dstjacques/ddgr/contributors","subscribers_url":"https://api.github.com/repos/dstjacques/ddgr/subscribers","subscription_url":"https://api.github.com/repos/dstjacques/ddgr/subscription","commits_url":"https://api.github.com/repos/dstjacques/ddgr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dstjacques/ddgr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dstjacques/ddgr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dstjacques/ddgr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dstjacques/ddgr/contents/{+path}","compare_url":"https://api.github.com/repos/dstjacques/ddgr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dstjacques/ddgr/merges","archive_url":"https://api.github.com/repos/dstjacques/ddgr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dstjacques/ddgr/downloads","issues_url":"https://api.github.com/repos/dstjacques/ddgr/issues{/number}","pulls_url":"https://api.github.com/repos/dstjacques/ddgr/pulls{/number}","milestones_url":"https://api.github.com/repos/dstjacques/ddgr/milestones{/number}","notifications_url":"https://api.github.com/repos/dstjacques/ddgr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dstjacques/ddgr/labels{/name}","releases_url":"https://api.github.com/repos/dstjacques/ddgr/releases{/id}","deployments_url":"https://api.github.com/repos/dstjacques/ddgr/deployments","created_at":"2018-10-12T00:42:15Z","updated_at":"2018-10-13T00:18:18Z","pushed_at":"2018-10-13T00:18:16Z","git_url":"git://github.com/dstjacques/ddgr.git","ssh_url":"git@github.com:dstjacques/ddgr.git","clone_url":"https://github.com/dstjacques/ddgr.git","svn_url":"https://github.com/dstjacques/ddgr","homepage":"","size":322,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jarun:master","ref":"master","sha":"a7017b35f5c937fec1942756716aaf52e9821dcc","user":{"login":"jarun","id":5959286,"node_id":"MDQ6VXNlcjU5NTkyODY=","avatar_url":"https://avatars3.githubusercontent.com/u/5959286?v=4","gravatar_id":"","url":"https://api.github.com/users/jarun","html_url":"https://github.com/jarun","followers_url":"https://api.github.com/users/jarun/followers","following_url":"https://api.github.com/users/jarun/following{/other_user}","gists_url":"https://api.github.com/users/jarun/gists{/gist_id}","starred_url":"https://api.github.com/users/jarun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarun/subscriptions","organizations_url":"https://api.github.com/users/jarun/orgs","repos_url":"https://api.github.com/users/jarun/repos","events_url":"https://api.github.com/users/jarun/events{/privacy}","received_events_url":"https://api.github.com/users/jarun/received_events","type":"User","site_admin":false},"repo":{"id":62723181,"node_id":"MDEwOlJlcG9zaXRvcnk2MjcyMzE4MQ==","name":"ddgr","full_name":"jarun/ddgr","private":false,"owner":{"login":"jarun","id":5959286,"node_id":"MDQ6VXNlcjU5NTkyODY=","avatar_url":"https://avatars3.githubusercontent.com/u/5959286?v=4","gravatar_id":"","url":"https://api.github.com/users/jarun","html_url":"https://github.com/jarun","followers_url":"https://api.github.com/users/jarun/followers","following_url":"https://api.github.com/users/jarun/following{/other_user}","gists_url":"https://api.github.com/users/jarun/gists{/gist_id}","starred_url":"https://api.github.com/users/jarun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarun/subscriptions","organizations_url":"https://api.github.com/users/jarun/orgs","repos_url":"https://api.github.com/users/jarun/repos","events_url":"https://api.github.com/users/jarun/events{/privacy}","received_events_url":"https://api.github.com/users/jarun/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jarun/ddgr","description":":duck: DuckDuckGo from the terminal","fork":false,"url":"https://api.github.com/repos/jarun/ddgr","forks_url":"https://api.github.com/repos/jarun/ddgr/forks","keys_url":"https://api.github.com/repos/jarun/ddgr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jarun/ddgr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jarun/ddgr/teams","hooks_url":"https://api.github.com/repos/jarun/ddgr/hooks","issue_events_url":"https://api.github.com/repos/jarun/ddgr/issues/events{/number}","events_url":"https://api.github.com/repos/jarun/ddgr/events","assignees_url":"https://api.github.com/repos/jarun/ddgr/assignees{/user}","branches_url":"https://api.github.com/repos/jarun/ddgr/branches{/branch}","tags_url":"https://api.github.com/repos/jarun/ddgr/tags","blobs_url":"https://api.github.com/repos/jarun/ddgr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jarun/ddgr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jarun/ddgr/git/refs{/sha}","trees_url":"https://api.github.com/repos/jarun/ddgr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jarun/ddgr/statuses/{sha}","languages_url":"https://api.github.com/repos/jarun/ddgr/languages","stargazers_url":"https://api.github.com/repos/jarun/ddgr/stargazers","contributors_url":"https://api.github.com/repos/jarun/ddgr/contributors","subscribers_url":"https://api.github.com/repos/jarun/ddgr/subscribers","subscription_url":"https://api.github.com/repos/jarun/ddgr/subscription","commits_url":"https://api.github.com/repos/jarun/ddgr/commits{/sha}","git_commits_url":"https://api.github.com/repos/jarun/ddgr/git/commits{/sha}","comments_url":"https://api.github.com/repos/jarun/ddgr/comments{/number}","issue_comment_url":"https://api.github.com/repos/jarun/ddgr/issues/comments{/number}","contents_url":"https://api.github.com/repos/jarun/ddgr/contents/{+path}","compare_url":"https://api.github.com/repos/jarun/ddgr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jarun/ddgr/merges","archive_url":"https://api.github.com/repos/jarun/ddgr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jarun/ddgr/downloads","issues_url":"https://api.github.com/repos/jarun/ddgr/issues{/number}","pulls_url":"https://api.github.com/repos/jarun/ddgr/pulls{/number}","milestones_url":"https://api.github.com/repos/jarun/ddgr/milestones{/number}","notifications_url":"https://api.github.com/repos/jarun/ddgr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jarun/ddgr/labels{/name}","releases_url":"https://api.github.com/repos/jarun/ddgr/releases{/id}","deployments_url":"https://api.github.com/repos/jarun/ddgr/deployments","created_at":"2016-07-06T13:30:54Z","updated_at":"2018-11-12T03:31:25Z","pushed_at":"2018-11-12T03:24:06Z","git_url":"git://github.com/jarun/ddgr.git","ssh_url":"git@github.com:jarun/ddgr.git","clone_url":"https://github.com/jarun/ddgr.git","svn_url":"https://github.com/jarun/ddgr","homepage":"","size":300,"stargazers_count":563,"watchers_count":563,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":45,"open_issues":2,"watchers":563,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jarun/ddgr/pulls/70"},"html":{"href":"https://github.com/jarun/ddgr/pull/70"},"issue":{"href":"https://api.github.com/repos/jarun/ddgr/issues/70"},"comments":{"href":"https://api.github.com/repos/jarun/ddgr/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/jarun/ddgr/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/jarun/ddgr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jarun/ddgr/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/jarun/ddgr/statuses/c4826312834de8cdb58278d415ac6b0cc9b54e06"}},"author_association":"NONE"}}
{"actor":{"display_login":"jarun"}}