当前位置: 首页 > wzjs >正文

怎么评价网站做的好坏seo在线教学

怎么评价网站做的好坏,seo在线教学,灵山招聘网灵山英才网做灵山专业的招聘网站,wordpress生成项目上移植了研发部的产品,文档不全,项目上验证码功能无法关闭,又要做接口/性能测试,开发不配合(作为测试多么无奈),此方法识别命中率不高,仅作借鉴。 版本JDK11 import io.restass…

项目上移植了研发部的产品,文档不全,项目上验证码功能无法关闭,又要做接口/性能测试,开发不配合(作为测试多么无奈),此方法识别命中率不高,仅作借鉴。
版本JDK11

import io.restassured.response.Response;
import net.sourceforge.tess4j.Tesseract;import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;import static io.restassured.RestAssured.given;public class ImageCodeTess {/*** urlInfo基本信息* */public static String getUrl(String prototype,String host,String port,String uri){UrlInfo urlInfo = new UrlInfo();urlInfo.setPrototype(prototype);urlInfo.setHost(host);urlInfo.setPost(port);urlInfo.setUri(uri);return urlInfo.toString();}/*** 获取验证码的响应map* */public static Map<String,String> getImageBase64Map(String url){Map<String,String> map = new HashMap<>();Response response = given().when().get(url).then().extract().response();map.put("imageContent",response.jsonPath().get("imageContent"));# 登录接口要用到deviceId,和imageContent是绑定的map.put("deviceId",response.jsonPath().get("deviceId"));return map;}/*** 下载验证码图片* */public static String getImageBase64(Map map){String[] resData = map.get("imageContent").toString().split(";");String base64Image = resData[2];String imageStr = base64Image.substring(base64Image.lastIndexOf(",")+1);return imageStr;}/*** @Method downloadImageCode() 下载base64字符串转码的图片* @param ImageStr base64字符串* @param ImagePath 下载地址前缀* */public static String downloadImageCode(String ImageStr,String ImagePath) {/** JDK11版本中针对sun.misc.BASE64Encoder 使用方法进行了修改升级.* jdk8中:*   BASE64Decoder decoder = new BASE64Decoder();*   byte[] bytes = decoder.decodeBuffer(str);* JDK11中变更为:java.util.Base64*   Base64.Decoder decoder = Base64.getMimeDecoder();*   byte[] bytes = decoder.decode(str);* */Base64.Decoder decoder = Base64.getDecoder();if (ImageStr == null) {return "下载失败";}String imageFilePath;try {byte[] b = decoder.decode(ImageStr);for (int i = 0; i < b.length; ++i) {if (b[i] < 0) {b[i] += 256;}}int rdm = (int) Math.random()*100;imageFilePath = ImagePath + System.currentTimeMillis() + rdm + ".png";OutputStream outputStream = new FileOutputStream(imageFilePath);outputStream.write(b);outputStream.flush();outputStream.close();} catch (Exception e) {return "下载失败";}return imageFilePath;}/*** 图片降噪处理,借鉴了某大佬的代码* */public static String removeBackground(String imagePath) {// RGB阈值int threshold = 500;String resultPath = null;try {BufferedImage bufferedImage = ImageIO.read(new File(imagePath));int width = bufferedImage.getWidth();int height = bufferedImage.getHeight();for (int x = 0; x < width; x++) {for (int y = 0; y < height; y++) {Color color = new Color(bufferedImage.getRGB(x, y));/*System.out.println("red:" + color.getRed() + ";green:" + color.getGreen() + ";blue:" + color.getBlue());*/int num = color.getRed() + color.getGreen() + color.getBlue();if (num >= threshold) {bufferedImage.setRGB(x, y, Color.WHITE.getRGB());}}}for (int i = 0; i < width; i++) {Color color1 = new Color(bufferedImage.getRGB(i, 1));int num1 = color1.getRed() + color1.getGreen() + color1.getBlue();for (int x = 0; x < width; x++) {for (int y = 0; y < height; y++) {Color color = new Color(bufferedImage.getRGB(x, y));int num = color.getRed() + color.getGreen() + color.getBlue();if (num == num1) {bufferedImage.setRGB(x, y, Color.WHITE.getRGB());} else {bufferedImage.setRGB(x, y, Color.BLACK.getRGB());}}}}resultPath = imagePath.substring(0, imagePath.lastIndexOf(".")) + "_1.png";File file = new File(resultPath);ImageIO.write(bufferedImage, "png", file);} catch (Exception e) {e.printStackTrace();}return resultPath.toString();}/*** 识别处理后的验证码图片* */public static String getImageCode(String ImageFilePath) {String result = null;try {Tesseract tesseract = new Tesseract();tesseract.setDatapath("C:/Program Files/Tesseract-OCR/tessdata");tesseract.setLanguage("eng");result = tesseract.doOCR(new File(ImageFilePath));} catch (Exception e) {e.printStackTrace();}return result;}
}
http://www.dtcms.com/wzjs/291531.html

相关文章:

  • 西安网站建设地址优化关键词软件
  • wordpress网站搬家图片路径营业推广名词解释
  • 奢侈品+网站建设方案深圳全网营销方案
  • 网站建设与网络营销网站seo排名优化工具
  • 用ps做零食网站模板seo网络推广招聘
  • 深圳做网站的好公司北京网站推广机构
  • 天河区进一步seo英文怎么读
  • 如何免费建网站赚钱中国网站排名前100
  • 手机应用开发湖南正规seo公司
  • b2b网站首页设计南宁seo推广优化
  • 做司法考试真题的网站网站排名优化培训课程
  • wordpress客户端APP广东seo推广贵不贵
  • 网站建设使用的什么软件有哪些内容百度关键词优化策略
  • 自建网站视频教程seo推广任务小结
  • 新型h5网站建设电商seo优化
  • 手机网站大全1百度人气榜排名
  • 官方网站建设源码系统百度推广关键词查询
  • 怎么把电脑当服务器做网站百度热搜电视剧
  • 个人做网站开工作室高端营销型网站
  • 怎样在百度免费做网站如何制作公司网页
  • 做盗版电影网站整合营销策略有哪些
  • 湖北网站建设报价域名批量查询系统
  • wordpress主机免费seo工资
  • 做关键字要改网站网站seo 优化
  • WordPress判断用户角色上海搜索引擎关键词优化
  • 工作室做网站流程山东seo推广
  • wordpress argo江苏seo网络
  • 做平面设计去哪些网站找图电商网店
  • 3合1网站建设福州seo招聘
  • 宣城市建设监督管理局网站下载百度网站大全