var data = JSON.parse(value);

if ("html" in data){
    if (data.html.head.title === "Document Error: Unauthorized")
        {return 1}
    else if (data.html.head.title === "Connection error")
        {return 2}
}
return 0;