15
0
Introduction
Sometimes I get bored and there are no new questions on PPCG, so I want you to dig a random question from PPCG's past.
Challenge
Given a user's PPCG ID as input (e.g. my ID is 30525), output the URL of a randomly chosen PPCG question. If the question does not meet the following criteria, you must choose another question until it does meet the criteria:
- The question asker must not be the user whose ID was inputted to the question
- The question must not have already been answered by the user whose ID was inputted to the question
- The question must not be unanswered: it's probably too hard
- The question must not have over 10 answers: it's probably too easy
- The question must be tagged code-golf
Rules
URL shorteners are disallowed.
You may use the Stack Exchange API and the Stack Exchange Data Explorer.
You will only ever be given a real PPCG user's ID.
In the unlikely event that there are no suitable questions, you do not have to output anything (undefined behaviour is fine).
Side Challenge
Although you won't be awarded extra points, it would be appreciated if someone designed a usable bookmarklet which, when run, opened the browser window to a random PPCG question that follows the above criteria. The user ID should be hardcoded into program (for the bookmarklet only).
Challenge
The shortest code in bytes wins.
1based my powershell answer on this one, nice reuse of the strings for the api. – colsw – 2017-05-24T10:47:39.523
At which point do you get banned permanently? ;) – Beta Decay – 2017-05-24T11:13:44.703
@BetaDecay, if the API challenges pick up pace again, I might soon find out! :D – Shaggy – 2017-05-24T11:14:55.513
You can use the api tokens from here: https://stackapps.com/q/7384/45852 to increase your rate limit.
– programmer5000 – 2017-05-24T13:57:27.033Gave me "Golf you an Anagram for great good!" (my own question) for the default id! :D – Arjun – 2017-05-24T14:59:05.700
You put the heart across me there, @Arjun; thought you were about to tell me it returned one of your own questions for your ID! – Shaggy – 2017-05-24T15:00:42.153
Don't worry, that's not the case! :) – Arjun – 2017-05-24T15:02:20.523
This is only returning questions which are on the front page... :P Not exactly what I was looking for – Beta Decay – 2017-05-24T18:52:32.677
@BetaDecay, will it suffice as a solution to the challenge? If not, I could (in ascending order of extra bytes): 1. Get the first 5 pages of questions, 2. get the last page, 3. both of the above, 4. Get all questions. Let me know which would meet the requirements but note that the last option involves a lot of queries to the API. – Shaggy – 2017-05-24T19:25:03.930
@Shaggy Well I think it is within rules, so you don't need to change it, but it doesn't really fit into the
digging questions from PPCG's past
box :/ – Beta Decay – 2017-05-24T19:27:01.0101@BetaDecay, I did intend on expanding it into a usable script but ran out of time; I'll try to come back to it tomorrow. – Shaggy – 2017-05-24T19:31:35.223
@BetaDecay; boomarklet now available :) – Shaggy – 2017-05-25T09:35:24.610
Nice! This'll be great :D – Beta Decay – 2017-05-25T09:37:06.587