赞
踩
- /**
- * 联众图像识别函数
- * @param {string} username 联众图像识别账号
- * @param {string} password 联众图像识别密码
- * @param {object} img 识别图片
- * 快手极速版
- */
-
-
- if (!requestScreenCapture()) {
- toast("请求截图失败");
- exit();
- }
- captureScreen("/sdcard/1" + ".jpg");//截图
-
- var a = className("android.view.View").clickable(true).depth(13).findOne().parent().bounds()
- var imgx = a.left
- var imgy = a.top
- var imgw = a.width()
- var imgh = a.height()
-
- var src = images.read("/sdcard/1.jpg");
- var clip = images.clip(src,imgx, imgy, imgw, imgh);//裁剪滑块区域图片
- images.save(clip, "/sdcard/clip.png");
-
- username = ""//联众账号
- password = ""//联众密码
- img = images.read("/sdcard/clip.png")//读取本机图片路径
-
- var x1 = getCode(username, password, img).data.res.split("|")[0].split(",")[0]
- var x2 = getCode(username, password, img).data.res.split("|")[1].split(",")[0]
- log(x1)
- log(x2)///返回打码结果
-
- //获取滑动坐标
- var h =className("android.view.View").clickable(true).depth(12).findOne().bounds().centerY();
-
- //开始滑动
- swipe(x1,h,x2+10,h,1000);
-
- function getCode(username, password, img) {
- http.__okhttp__.setTimeout(3e4);
- var r = images.toBase64(img, format = "png"), i = device.release, c = device.model, s = device.buildId;
- try {
- var n = http.postJson("https://v2-api.jsdama.com/upload", {
- softwareId: 19017, //软件ID
- softwareSecret: "", //秘钥
- username: username,
- password: password,
- captchaData: r,
- captchaType: 1310, //识别类型(整形),
- captchaMinLength: 0,
- captchaMaxLength: 0,
- workerTipsId: 0
- }, {
- headers: {
- "User-Agent": "Mozilla/5.0 (Linux; Android " + i + "; " + c + " Build/" + s + "; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 Mobile Safari/537.36",
- }
- });
- } catch (e) {
- return {
- code: "-1",
- msg: "网络链接超时...",
- data: {}
- };
- }
- var d = n.body.json(), p = d.code, m = d.message;
- if ("10079009" == p) return {
- code: p,
- msg: m,
- data: {}
- };
- if ("10142006" == p) return {
- code: p,
- msg: m,
- data: {}
- };
- if ("10142004" == p) return {
- code: p,
- msg: m,
- data: {}
- };
- if ("10142005" == p) return {
- code: p,
- msg: m,
- data: {}
- };
- if ("10079006" == p) return {
- code: p,
- msg: m,
- data: {}
- };
- if ("0" == p) {
- return {
- code: p,
- msg: m,
- data: {
- res: d.data.recognition
- }
- };
- }
- return d;
- }
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。