diff --git a/sherlock/resources/data.json b/sherlock/resources/data.json index 2ca46a9..e058d4c 100644 --- a/sherlock/resources/data.json +++ b/sherlock/resources/data.json @@ -1280,7 +1280,7 @@ "username_claimed": "blue" }, "Minecraft": { - "errorCode": [204, 404, 405], + "errorCode": 204, "errorType": "status_code", "url": "https://api.mojang.com/users/profiles/minecraft/{}", "urlMain": "https://minecraft.net/", @@ -1763,7 +1763,7 @@ "username_claimed": "blue" }, "Slides": { - "errorCode": [204, 404], + "errorCode": 204, "errorType": "status_code", "url": "https://slides.com/{}", "urlMain": "https://slides.com/", diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 96e41e6..6045918 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -406,19 +406,17 @@ def sherlock( else: query_status = QueryStatus.AVAILABLE elif error_type == "status_code": - query_status = QueryStatus.AVAILABLE error_codes = net_info.get("errorCode") + query_status = QueryStatus.CLAIMED - if error_codes: # (if set in data.json) - if isinstance(error_codes, int): - if error_codes != r.status_code: - query_status = QueryStatus.CLAIMED - else: - if r.status_code not in error_codes: - query_status = QueryStatus.CLAIMED - # Checks if the status code of the response is 2XX - elif not r.status_code >= 300 or r.status_code < 200: - query_status = QueryStatus.CLAIMED + # Type consistency, allowing for both singlets and lists in manifest + if isinstance(error_codes, int): + error_codes = [error_codes] + + if r.status_code in error_codes: + query_status = QueryStatus.AVAILABLE + elif r.status_code >= 300 or r.status_code < 200: + query_status = QueryStatus.AVAILABLE elif error_type == "response_url": # For this detection method, we have turned off the redirect. # So, there is no need to check the response URL: it will always