2

Is it possible to get the next page of results for a duck duck go search on the html version using a url query param?

weaveoftheride
  • 4,092
  • 8
  • 35
  • 53
  • I'd turn off JavaScript in the browser and see what it serves - it'll likely give you a number of page links – Pekka Mar 13 '16 at 19:53
  • 1
    I used bing in the end because I could get more results per page and then also go to the next page using the url params. – weaveoftheride Mar 21 '16 at 16:53

1 Answers1

10

I found that with the right parameters, it is possible to get different pages from the /html/ version of duckduckgo.com.

You need to specify:

  • q for the search
  • s for the offset of the current page (nothing for the first page)
  • dc for the offset of the current page + 1 (start of the new page, nothing for the first page)
  • v to the arbitrary value l
  • o to the format json
  • api to the endpoint /d.js

Which gives, given the search $term and the page $n:

https://duckduckgo.com/html/?q=$term&s=$(($n*30))&dc=$(($n*30+1))&v=l&o=json&api=/d.js

And for the first page:

https://duckduckgo.com/html/?q=$term&s=&dc=&v=l&o=json&api=/d.js

Note 1: This can be used with both GET and POST HTML methods.

Note 2: According to my tests, it appears that the s and dc parameters need to respectively be a multiple of 30, and a multiple of 30, plus 1.

HTH

7heo.tk
  • 1,074
  • 12
  • 23