# Am I outgolfed by Dennis?

According to legend, almost everyone is outgolfed by Dennis. If not, they will be.

Now I'm curious if I'm one of those 'almost everyone'.

You will be given a link to an answer in the format of https://codegolf.stackexchange.com/questions/[QUESTION ID]/[QUESTION NAME]/#[ANSWER ID].

Find the length of the code, which we will assume as the last number on the first line (markdown wise) of the answer in the link.

Then, search for Dennis' answers, and do the same.

Now compare the input's and Dennis' answers code length, and if it is out-golfed (meaning one or more answer of Dennis' is shorter than that of the input answer), output a truthy value, and if not, a falsy value.

If there is no answer belonging to Dennis on the same question as the answer, output a falsy value.

# Examples

• Link : true
• Link : false (At least for now, tell me when it changes)

# Rules

• You may use any form of truthy/falsy value.
• The question of the answer you're given will always be .
• The question may not have an answer of Dennis', but the inputted answer will never belong to Dennis.

• You may assume there is always a number on the first line of the answer.

• Can we assume there will always be an answer by Dennis on the given question, and that the given answer will not be Dennis' answer? – Skidsdev May 10 '17 at 10:42
• @Mayube No, and yes. – Matthew Roh May 10 '17 at 10:42
• Do we need to handle paging or can we assume both answers will be on the same page if there are multiple pages of answers? – Shaggy May 10 '17 at 10:42
• @Shaggy former. – Matthew Roh May 10 '17 at 10:43
• @SIGSEGV If there is no answer by Dennis do we output false because Dennis has not outgolfed the answer? – Skidsdev May 10 '17 at 10:43

## Python 3.6 + requests + bs4 - 363 358 bytes

import bs4,re,requests
u,n=input().split("/#");i=1;d=y=float("inf")
while i:
for a in A:
c=int(re.findall("\d+",(a("h1")+a("h2")+a("p"))[0].text)[-1])
if "Dennis"in a(class_="user-details")[-1].text:d=min(c,d)
i=A and i+1;
print(d<y)


Prints True or False.

Note: does not currently work on the second link because of invalid HTML produced by this answer (the em and strong tags are terminated in the wrong order at the end of the second line, and causes the parser to miss the username block). Try it on this link instead.

## Using the API - 401 380 bytes

import requests,re
q,A=re.findall("\d+",input());i=1;d=y=float("inf")
while i:
c=int(re.search("(\d+)\D+$",a["body"]).group(1)) if a["owner"]["user_id"]==12012:d=min(d,c) if a["answer_id"]==A:y=c print(d<y)  Note that this also fails on the second link, but because one answer started with This may be foul play. instead of the header... • Consider using the Stack Exchange API to get answer data instead via JSON parser, just make sure filter=withbody is in your GET request in order to obtain the answer body to grab the byte count – Value Ink May 10 '17 at 19:57 • With the API version, you used a twice (once to set the answer ID, and another when iterating r["items"], which would lead to incorrect behavior. Also, you don't need to set the pagesize (it will default to 30). c=int(re.search(r'(\d+) bytes').group(1)) should give you a more accurate retrieval of bytecount and is shorter, and if it still fails, (\d+)\s*bytes does the trick but is a bit longer. Finally, i=r["has_more"]and i+1 is shorter than your ternary conditional. – Value Ink May 10 '17 at 21:23 • Actually, forget about the regex match. I forgot to account for adding the answer body in the function call so that part is longer. The other suggestions are still valid, though. – Value Ink May 11 '17 at 1:19 • @ValueInk Thanks, bit shorter now. Looks like we need a golfing language just for the API, its calls are sooo long... – matsjoyce May 11 '17 at 7:28 • Perhaps. But honestly there's also the fact that you have a nice HTML parser, plus the fact that you're given the question URL by default. If the input were two numbers instead, there would be quite a bit of overhead for getting the page for the codegolf question as well. – Value Ink May 11 '17 at 19:58 # Ruby, 314315 308+20 = 334335 328 bytes Uses the flags -n -rjson -ropen-uri. +1 byte from fixing a minor bug. -7 bytes by discovering the open-uri Ruby default library. ~/(\d+)\D+(\d+)/ u="http://api.stackexchange.com/2.2/questions/#$1/answers?site=codegolf&filter=withbody&page=%s"