prepare("select id,username,domain,display_name,avatar_file_name from accounts where username ~ '^[0-9a-z]{10}$' and created_at > '2024-02-15 00:00:00' and suspended_at IS NULL AND avatar_file_name IS NULL AND id NOT IN (".implode(",",$conf["exclude"]).");"); $stmt->execute(); $first=true; $badsizes=["1009x200"]; $badblur=['UkKBv%k8Oas:t1f9V[ae|;afoJofs;bYovjZ', 'UkKBv%k8Oas:t1f9V[ae|;agoJoft7bYovjZ','UkKBv%k8Oas:t1f9V[ae|;afoKofs;bYovjs']; $badtext=["画像が貼れなか","ったのでメンションだけ"]; while ($c=$stmt->fetch(PDO::FETCH_ASSOC)) { if ($first) { $api=get_api_client(); $first=false; } // print_r($c); // get the statuses of one account $statuses = $api->get("/accounts/".$c["id"]."/statuses"); // print_r($statuses); // search for statuses having : // a picture of 1009x200 AND at least one mention // or a blurhash of UTQcbkVY%gIU8w8_%Mxu%2Rjayt7.8?bMxRj ? (maybe not good) $isbad=false; foreach($statuses as $s) { foreach($badtext as $text) { if (strpos($s["content"],$text)!==false) { $reason="bad text $text"; $isbad=true; break 2; } } if (is_array($s["media_attachments"])) { foreach($s["media_attachments"] as $i) { if ($i["type"]=="image") { if (in_array($i["blurhash"],$badblur)) { // echo "Bad BlurHash (".$i["blurhash"].")\n"; $reason="bad BlurHash (".$i["blurhash"].")"; $isbad=true; break 2; } if (in_array($i["meta"]["original"]["width"]."x".$i["meta"]["original"]["height"],$badsizes)) { // echo "Bad Size (".$i["meta"]["original"]["width"]."x".$i["meta"]["original"]["height"].")\n"; $reason="bad size (".$i["meta"]["original"]["width"]."x".$i["meta"]["original"]["height"].")"; $isbad=true; break 2; } echo "Unknwon Image (not bad?): ".$i["meta"]["original"]["width"]."x".$i["meta"]["original"]["height"]." blur ".$i["blurhash"]." at:\n ".$i["url"]." for ".$c["id"]."\n"; } } } if ($isbad) break; } if ($isbad) { echo "Will block ".$c["username"]."@".$c["domain"]." reason $reason\n"; $result = $api->post("/admin/accounts/".$c["id"]."/action",["type" => "suspend", "text" => "Automatic suspend: $reason"] ); print_r($result); } else { echo "skip ".$c["id"]." ".$c["username"]." good user\n"; } sleep(4); } // for each bad user (potentially)