private static boolean isValidContentType(URLConnection connection) {
        String type = connection.getContentType();
        boolean isValid = true;
        if (type != null && type.length() >= 5) {
            String category = type.substring(0, 5);
            isValid = !category.equals("image") && !category.equals("audio") && !category.equals("video");
        }
        return isValid;
    }