Detect Duplicate Questions
Python 3
I am giving this entry the name The Differ.
Code:
import urllib.request, gzip, re, json, difflib, sys
API_URL = &quot;https://api.stackexchange.com/&quot;
qurl = input()
qid = int(re.search(&quot;\d+&quot;,qurl).group(0))
def request(url,wrapper=False,**params):
    params.setdefault(&quot;filter&quot;,&quot;withbody&quot;)
    params.setdefault(&quot;site&quot;,&quot;codegolf&quot;)
    url = API_URL + url + &quot;?&quot;+&quot;&amp;&quot;.join([str(k)+&quot;=&quot;+str(v) for k,v in params.items()])
    compressed_response = urllib.request.urlopen(url)
    response = gzip.decompress(compressed_response.read()).decode(&quot;utf8&quot;)
    response_object = json.loads(response)
    if wrapper:
        return response_object
    else:
        return response_object[&quot;items&quot;]
question = request(&quot;questions/%s&quot;%qurl)[0]
tags = &quot;;&quot;.join(question[&quot;tags&quot;])
title = question[&quot;title&quot;]
escaped = title.replace(&quot; &quot;,&quot;%20&quot;)
related = request(&quot;similar&quot;,title=escaped,pagesize=100)
hasmore = False
length = sys.maxsize
for tag in question[&quot;tags&quot;]:
    result = request(&quot;search&quot;,tagged=tag,
                     wrapper=True,
                     filter=&quot;!-*f(6rc.cI8O&quot;,
                     pagesize=100)
    if result[&quot;total&quot;] &lt; length:
        length = result[&quot;total&quot;]
        related.extend(result[&quot;items&quot;])
        hasmore = result[&quot;has_more&quot;]
        besttag = tag
related.extend(best)
if length &lt; 1500:
    for page in itertools.count(2):
        if not hasmore:
            break
        response = request(&quot;search&quot;,
                           tagged=besttag,
                           page=page,
                           pagesize=100,
                           filter=&quot;!-*f(6rc.cI8O&quot;,
                           wrapper=True)
        hasmore = response[&quot;has_more&quot;]
        related.extend(result[&quot;items&quot;])
matcher = difflib.SequenceMatcher(None, question[&quot;body&quot;], None)
titlematcher = difflib.SequenceMatcher(None, question[&quot;title&quot;], None)
seen = set()
seen.add(question[&quot;question_id&quot;])
for possible in related:
    matcher.set_seq2(possible[&quot;body&quot;])
    titlematcher.set_seq2(possible[&quot;title&quot;])
    score = matcher.ratio()+titlematcher.ratio()
    qid = possible[&quot;question_id&quot;]
    if score &gt; .85 and qid not in seen:
        print(qid)
        seen.add(qid)
print(&quot;end&quot;)

The filter &quot;!-*f(6rc.cI8O&quot; included the total parameter on the global wrapper object and the body parameter on questions.
This entry makes two API requests plus one per tag on the question plus one per hundred questions in its least used tag. If it hits an api throttle (which it doesn't check for), it will raise an urllib.error.HTTPError: HTTP Error 400: Bad Request