Give me some questions to answer!
JavaScript (ES6), 333 329 327 323 283 bytes
Needs to be run from within the api.stackexchange.com
domain (relevant meta). Returns a Promise
containing the URL (relevant meta).
f=async i=>await(u="/questions/",s="?tagged=code-golf&site=codegolf",q=await(await(await fetch(u+s)).json()).items.filter(x=>x.owner.user_id!=i&x.answer_count<11).sort(_=>.5-Math.random())[0],await(await fetch(u+q.question_id+s)).json()).items.some(x=>x.owner.user_id==i)?f(i):q.link
Try it
f=async i=>await(u="//api.stackexchange.com/questions/",s="?tagged=code-golf&site=codegolf",q=await(await(await fetch(u+s)).json()).items.filter(x=>x.owner.user_id!=i&x.answer_count<11).sort(_=>.5-Math.random())[0],await(await fetch(u+q.question_id+s)).json()).items.some(x=>x.owner.user_id==i)?f(i):q.link
k.previousSibling.value=58974 // me
k.onclick=_=>f(+k.previousSibling.value).then(p=>k.nextSibling.innerText=p)
<input type=number><button id=k>Fetch</button><pre>
Bookmarklet
And here it is as a customisable bookmarklet, which will load a random question you've yet to answer. To use it, simply add a new bookmark to your browser's toolbar and drop the full code into the URL field.
Unlike the above solution, this works with all questions on a site therefore it may be slow to run (depending on the site and tags) and could also be expensive in the number of queries it needs to make to the API, as the API can only return 100 questions at a time.
To customise, change the following variables
k
: Your API key - you can register for one here.s
: The Stack Exchange site you want to grab a question for.i
: Your user ID on that site.t
: The tags you want to filter by. There are 4 options available for this one:""
: An empty string; if you don't want to filter by any tags,"code-golf;string"
: A semi-colon separated list of tags you want to filter by,prompt("Tags:")
: You will be prompted to enter the tags you want to filter by, or,prompt("Tags:","code-golf;string")
: You will be prompted to enter the tags you want to filter by, with a default list provided.
javascript:(f=(
/* See https://codegolf.stackexchange.com/a/122400/58974 for documenation */
k="",
s="codegolf",
i=58974,
t="code-golf",
p=1,q=[],r=1)=>fetch((u="//api.stackexchange.com/questions/")+(d=`?key=${k}&tagged=${t}&site=`+s)+`&page=${p}&pagesize=100`).then(r=>r.json()).then(j=>r&&(q=[...q,...j.items.filter(x=>x.owner.user_id!=i&(a=x.answer_count)&a<11)])^j.has_more?f(i,k,s,t,p+1,q,1):q.sort(_=>.5-Math.random())[0]).then(y=>fetch(u+y.question_id+"/answers"+d).then(r=>r.json()).then(j=>j.items.some(x=>x.owner.user_id==i)?f(i,k,s,t,q,0):window.location=y.link)))()
PowerShell, 261 Bytes
param($i)$q=irm (($u="api.stackexchange.com/questions/")+($s="?tagged=code-golf&site=codegolf"))
do{$t=$q.items|?{$c=$_|% an*;$_.owner.user_id-ne$i-and$c-gt0-and$c-lt10}|random}while((irm($u+$t.question_id+'/answers'+$s)).items.owner.user_id-contains$i)
$t.link
Explanation:
param($i)
$q=irm (($u="api.stackexchange.com/questions/")+($s="?tagged=code-golf&site=codegolf")) #run this query
do{ #until we find a valid question, get a random one that fits the basic specs
$t=$q.items|?{$c=$_|% an*;$_.owner.user_id-ne$i-and$c-gt0-and$c-lt10}|random
}while( #Get all of the answers, and their owners into an array, check it doens't contain the provided id
(irm($u+$t.question_id+'/answers'+$s)).items.owner.user_id-contains$i
)
$t.link #output the question link
add 4 bytes for a version which opens it in webbrowser
param($i)$q=irm (($u="api.stackexchange.com/questions/")+($s="?tagged=code-golf&site=codegolf"))
do{$t=$q.items|?{$c=$_|% an*;$_.owner.user_id-ne$i-and$c-gt0-and$c-lt10}|random}while((irm($u+$t.question_id+'/answers'+$s)).items.owner.user_id-contains$i)
saps $t.link