The entire function is basically this (requires Tridactyl native messenger).
command cp js -p tri.native.run('cd ~ && ddgr --json -n 1 ' +JS_ARG + '| jq -r ".[0].url" | xclip -sel clip')
[1] https://github.com/tridactyl/tridactyl[2] https://github.com/jarun/ddgr
[3] https://stedolan.github.io/jq/
PS: I used this tool itself to find the links for the three projects mentioned above.