andrewrjones/ruby-duck-duck-go — pull request #4 by Qeole (2014-07-31 22:19:13+00:00)
Title: Adding 'no_redirect=1' argument to http requests

Hi Andrew,

I had an issue with the DuckDuckGo `!bang` syntax, which usually redirects to other websites (e.g. https://ddg.gg/?q=!w+duckduckgo redirects to DuckDuckGo on Wikipedia):
`ddg.zeroclickinfo("!w duckduckgo")` would return source HTML from Wikipedia instead of a redirection link from DuckDuckGo.

I fixed it by adding a `no_redirect=1` HTTP argument to the request, based on following API example from the API page: https://api.duckduckgo.com/?q=!imdb+rushmore&format=json&pretty=1&no_redirect=1. `no_redirect=1` is added whether or not `!bang` syntax is used, but it does not seem to modify anything for other (non-redirected) results.