当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
api.js 31.89 KB
一键复制 编辑 原始数据 按行查看 历史
kyleks 提交于 2019-04-21 01:32 . 重命名文件最新API接码.js为api.js
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834
//接码平台API-V4.0
//From.TheHot.2019.3.18
//使用前请仔细查看以下参数
//下面注释块中为指定变量,请复制到脚本中,并且放置到最前方
//关于函数返回值,成功返回 结果 或 0,失败返回 -1
/*
var 接码平台 = "易码"; //关键词(共享、短租、火云、易码、芒果云、樱桃云、吸码皇、TheWolf),其他平台有待添加。
var 平台账号 = ""; //登陆用户名或API(部分平台需要用API账号,请前往电脑端获取)
var 登陆密码 = ""; //登陆密码
var 项目ID = ""; //接码项目ID
var 虚拟号设置 = "0"; //0为正常号段,1为虚拟号段,为空则随机
eval(http.get('https://gitee.com/thehot/auto/raw/master/TModules.js').body.string());
*/
//变量转换
var CodePlatform = 接码平台;
var Account_Api = 平台账号;
var PassWord = 登陆密码;
var Project_ID = 项目ID;
var Provinces = ""; //是否按省份获取,为空则随机,省份按照平台显示名称填写
var PhoneType = ""; //CMCC 为移动,UNICOM 为联通,TELECOM 为电信,为空则随机
var vno = 虚拟号设置;
//易码特殊设置项
if (vno == 0) {
var excludeno = "170.171.180";
var filterPrefix = "170,171,180";
} else {
var excludeno = "";
}
//芒果云、樱桃云特殊项设置
if(CodePlatform == "芒果云" && CodePlatform == "樱桃云"){
if(vno == 0){
vno = 1;
}else if(vno == 1){
vno = 0;
}else{
vno = vno;
}
}
var ProvincesCode = ""; //易码平台省份设置(填写省份代码,易码平台获取)
var isp = ""; //号码所属运营商代码。1:移动,2:联通,3:电信,为空则随机
//接码平台API地址
var gx_api = "http://api.ipadh.cn/do.php?action=";
var hy_api = "http://huoyun888.cn/api/do.php?action=";
var dz_api = "http://api.jmyzm.com/http.do?action=";
var ym_api = "http://api.fxhyd.cn/UserInterface.aspx?action=";
var dm_api = "http://api.duomi01.com/api?action=";
var xmh_api = "http://www.ximahuang.com/alz/api?action=";
var mgy_api = "http://www.mangopt.com:9000/doApi/";
var yty_api = "http://www.cherryun.com:8000/doApi/";
var TheWolf_api = "http://api.dk827.com/index.php/";
var storage = storages.create("TheWolf");
if (CodePlatform == "TheWolf") {
if (storage.contains("token") == true) {
if (verification_token() == 0) {
var LoginToken = storage.get("token");
} else {
var LoginToken = getToken(CodePlatform);
storage.put("token", LoginToken);
}
} else {
var LoginToken = getToken(CodePlatform);
storage.put("token", LoginToken);
}
}else{
var LoginToken = getToken(CodePlatform);
}
//验证TheWolf平台token合法性
// http://api.dk827.com/index.php/token?token=381fca50d18837ae631ef870679ddca7
function verification_token(){
var r = http.get(TheWolf_api + "token?token=" + storage.get("token"));
var j = r.body.json();
if(j.errno > 0){
toastLog(j.errmsg);
return -1;
}else if(j.errno == 0){
return 0;
}
return -1;
}
//获取token值
function getToken(CodePlatform) {
switch (CodePlatform) {
case "共享":
var r = http.get(gx_api + "loginIn&name=" + Account_Api + "&password=" + PassWord);
var token = r.body.string().split("|");
if (token[0] == 0) {
toastLog(token[1]);
return -1;
}
return token[1];
case "火云":
var r = http.get(hy_api + "loginIn&name=" + Account_Api + "&password=" + PassWord);
var token = r.body.string().split("|");
if (token[0] == 0) {
toastLog(token[1]);
return -1;
}
return token[1];
case "多米":
var r = http.get(dm_api + "loginIn&name=" + Account_Api + "&password=" + PassWord);
var token = r.body.string().split("|");
if (token[0] == 0) {
toastLog(token[1]);
return -1;
}
return token[1];
case "短租":
var r = http.get(dz_api + "loginIn&uid=" + Account_Api + "&pwd=" + PassWord);
var token = r.body.string();
if (token.indexOf(Account_Api) == -1) {
toastLog("短租账号登陆失败!");
return -1;
}
token = token.split("|");
return token[1];
case "易码":
var r = http.get(ym_api + "login&username=" + Account_Api + "&password=" + PassWord);
var token = r.body.string();
if (token.indexOf("success") == -1) {
toastLog("易码账号登陆失败!");
return -1;
}
token = token.split("|");
return token[1];
case "吸码皇":
// http://www.ximahuang.com/alz/api?action=loginIn&name=API账号&password=密码&developer=开发者参数
var r = http.get(xmh_api + "loginIn&name=" + Account_Api + "&password=" + PassWord);
var token = r.body.string().split("|");
if (token[0] == 0) {
toastLog(token[1]);
return -1;
}
return token[1];
case "芒果云":
// http://www.mangopt.com:9000/doApi/loginIn?name=API账号&password=密码
var r = http.get(mgy_api + "loginIn?name=" + Account_Api + "&password=" + PassWord);
var token = r.body.string().split("|");
if (token[0] == 0) {
toastLog(token[1]);
return -1;
}
return token[1];
case "樱桃云":
// http://www.mangopt.com:9000/doApi/loginIn?name=API账号&password=密码
var r = http.get(yty_api + "loginIn?name=" + Account_Api + "&password=" + PassWord);
var token = r.body.string().split("|");
if (token[0] == 0) {
toastLog(token[1]);
return -1;
}
return token[1];
case "TheWolf":
var r = http.get(TheWolf_api + "reg/login?username=" + Account_Api + "&password=" + PassWord);
r = r.body.json();
var errno = r.errno;
if (errno > 0) {
toastLog(r.errmsg);
return -1;
} else if (errno == 0) {
toastLog("TheWolf登录成功!");
return r.ret.token;
}
default:
toast("未接入该接码平台!");
}
}
//获取手机号函数
function GetPhone(phone) {
switch (CodePlatform) {
case "共享":
if (phone != null) {
var r = http.get(gx_api + "getPhone&sid=" + Project_ID + "&token=" + LoginToken + "&phone=" + phone);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
}
var r = http.get(gx_api + "getPhone&sid=" + Project_ID + "&token=" + LoginToken + "&locationMatching=include&locationLevel=p&location=" + Provinces + "&showExtra=1&phoneType=" + PhoneType + "&vno=" + vno);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
case "火云":
if (phone != null) {
var r = http.get(hy_api + "getPhone&sid=" + Project_ID + "&token=" + LoginToken + "&phone=" + phone);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
}
var r = http.get(hy_api + "getPhone&sid=" + Project_ID + "&token=" + LoginToken + "&locationMatching=include&locationLevel=p&location=" + Provinces + "&showExtra=1&phoneType=" + PhoneType + "&vno=" + vno);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
case "多米":
if (phone != null) {
var r = http.get(dm_api + "getPhone&sid=" + Project_ID + "&token=" + LoginToken + "&phone=" + phone);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
}
var r = http.get(dm_api + "getPhone&sid=" + Project_ID + "&token=" + LoginToken + "&locationMatching=include&locationLevel=p&location=" + Provinces + "&showExtra=1&phoneType=" + PhoneType + "&vno=" + vno);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
case "短租":
if (phone != null) {
var r = http.get(dz_api + "getMobilenum&pid=" + Project_ID + "&uid=" + Account_Api + "&token=" + LoginToken + "&mobile=" + phone);
phone = r.body.string();
if (phone.indexOf(LoginToken) == -1) {
toastLog("获取号码失败,请检查账户信息及项目ID!");
return -1;
}
phone = phone.split("|");
return phone[0];
}
var r = http.get(dz_api + "getMobilenum&pid=" + Project_ID + "&uid=" + Account_Api + "&token=" + LoginToken + "&mobile=&size=1&province=" + Provinces + "&showExtra=1&operator=" + PhoneType + "&vno=" + vno);
phone = r.body.string();
if (phone.indexOf(LoginToken) == -1) {
toastLog("获取号码失败,请检查账户信息及项目ID!");
return -1;
}
phone = phone.split("|");
return phone[0];
case "易码":
if (phone != null) {
var r = http.get(ym_api + "getmobile&token=" + LoginToken + "&itemid=" + Project_ID + "&mobile" + phone);
phone = r.body.string();
if (phone.indexOf("success") == -1) {
toastLog("获取号码失败,请检查账户信息及项目ID!");
return -1;
}
phone = phone.split("|");
return phone[1];
}
var r = http.get(ym_api + "getmobile&token=" + LoginToken + "&itemid=" + Project_ID + "&excludeno=" + excludeno + "&province=" + ProvincesCode + "&isp=" + isp);
phone = r.body.string();
if (phone.indexOf("success") == -1) {
toastLog("获取号码失败,请检查账户信息及项目ID!");
return -1;
}
phone = phone.split("|");
return phone[1];
case "吸码皇":
// http://www.ximahuang.com/alz/api?action=getPhone&sid=项目id&token=登录时返回的令牌
if (phone != null) {
var r = http.get(xmh_api + "getPhone&sid=" + Project_ID + "&token=" + LoginToken + "&phone=" + phone);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
}
var r = http.get(xmh_api + "getPhone&sid=" + Project_ID + "&token=" + LoginToken + "&location=" + Provinces + "&phoneType=" + PhoneType + "&filterPrefix=" + filterPrefix);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
case "芒果云":
// http://www.mangopt.com:9000/doApi/getPhone?sid=项目id&token=登录时返回的令牌
if (phone != null) {
var r = http.get(mgy_api + "getPhone?sid=" + Project_ID + "&token=" + LoginToken + "&phone=" + phone);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
}
var r = http.get(mgy_api + "getPhone?sid=" + Project_ID + "&token=" + LoginToken + "&location=" + Provinces + "&phoneType=" + PhoneType + "&vno=" + vno);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
case "樱桃云":
// http://www.mangopt.com:9000/doApi/getPhone?sid=项目id&token=登录时返回的令牌
if (phone != null) {
var r = http.get(yty_api + "getPhone?sid=" + Project_ID + "&token=" + LoginToken + "&phone=" + phone);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
}
var r = http.get(yty_api + "getPhone?sid=" + Project_ID + "&token=" + LoginToken + "&location=" + Provinces + "&phoneType=" + PhoneType + "&vno=" + vno);
phone = r.body.string().split("|");
if (phone[0] == 0) {
toastLog(phone[1]);
return -1;
}
return phone[1];
case "TheWolf":
var r = http.get(TheWolf_api + "clients/online/setWork?token=" + LoginToken + "&pid=" + Project_ID + "&t=1&ascription=1");
r = r.body.json();
if (r.errno == 0) {
return r.ret.number;
} else {
toastLog(r.errmsg);
return -1;
}
default:
toast("未接入该接码平台!");
}
}
//获取验证码函数
function GetCode(phone, setOverTime, pat) {
if (setOverTime == null) {
var setOverTime = 60;
}
if (pat == null) {
var pat = /\d+/g;
}
switch (CodePlatform) {
case "共享":
var tag = 0;
var k = 0;
while (tag == 0 && k < Math.ceil(setOverTime / 3)) {
toastLog("未获取到短信,等待3秒重试!");
sleep(3000);
var r = http.get(gx_api + "getMessage&phone=" + phone + "&sid=" + Project_ID + "&token=" + LoginToken);
var code = r.body.string().split("|");
tag = code[0];
code = code[1];
k = k + 1;
}
if (tag == 0) {
toastLog("获取验证码超时或失败!");
return -1;
}
code = code.match(pat);
return code[0];
case "火云":
var tag = 0;
var k = 0;
while (tag == 0 && k < Math.ceil(setOverTime / 3)) {
toastLog("未获取到短信,等待3秒重试!");
sleep(3000);
var r = http.get(hy_api + "getMessage&phone=" + phone + "&sid=" + Project_ID + "&token=" + LoginToken);
var code = r.body.string().split("|");
tag = code[0];
code = code[1];
k = k + 1;
}
if (tag == 0) {
toastLog("获取验证码超时或失败!");
return -1;
}
code = code.match(pat);
return code[0];
case "多米":
var tag = 0;
var k = 0;
while (tag == 0 && k < Math.ceil(setOverTime / 3)) {
toastLog("未获取到短信,等待3秒重试!");
sleep(3000);
var r = http.get(dm_api + "getMessage&phone=" + phone + "&sid=" + Project_ID + "&token=" + LoginToken);
var code = r.body.string().split("|");
tag = code[0];
code = code[1];
k = k + 1;
}
if (tag == 0) {
toastLog("获取验证码超时或失败!");
return -1;
}
code = code.match(pat);
return code[0];
case "短租":
var tag = 0;
var k = 0;
while (tag != phone && k < Math.ceil(setOverTime / 3)) {
toastLog("未获取到短信,等待3秒重试!");
sleep(3000);
var r = http.get(dz_api + "getVcodeAndReleaseMobile&uid=" + Account_Api + "&token=" + LoginToken + "&mobile=" + phone);
var code = r.body.string().split("|");
tag = code[0];
code = code[1];
k = k + 1;
}
if (tag != phone) {
toastLog("获取验证码超时或失败!");
return -1;
}
code = code.match(pat);
return code[0];
case "易码":
var tag = 0;
var i = 0;
while (tag != "success" && i < Math.ceil(setOverTime / 3)) {
var r = http.get(ym_api + "getsms&token=" + LoginToken + "&itemid=" + Project_ID + "&mobile=" + phone);
var code = r.body.string().split("|");
tag = code[0];
code = code[1];
i = i + 1;
toastLog("未获取到短信,等待3秒重试!");
sleep(3000);
}
if (tag != "success") {
toastLog("获取验证码超时或失败!");
return -1;
}
code = code.match(pat);
return code[0];
case "吸码皇":
// http://www.ximahuang.com/alz/api?action=getMessage&sid=项目id&phone=取出来的手机号&token=登录时返回的令牌
var tag = 0;
var k = 0;
while (tag == 0 && k < Math.ceil(setOverTime / 3)) {
toastLog("未获取到短信,等待3秒重试!");
sleep(3000);
var r = http.get(xmh_api + "getMessage&phone=" + phone + "&sid=" + Project_ID + "&token=" + LoginToken);
var code = r.body.string().split("|");
tag = code[0];
code = code[1];
k = k + 1;
}
if (tag == 0) {
toastLog("获取验证码超时或失败!");
return -1;
}
code = code.match(pat);
return code[0];
case "芒果云":
// http://www.mangopt.com:9000/doApi/getMessage?sid=项目id&phone=取出来的手机号&token=登录时返回的令牌
var tag = 0;
var k = 0;
while (tag == 0 && k < Math.ceil(setOverTime / 3)) {
toastLog("未获取到短信,等待3秒重试!");
sleep(3000);
var r = http.get(mgy_api + "getMessage?phone=" + phone + "&sid=" + Project_ID + "&token=" + LoginToken);
var code = r.body.string().split("|");
tag = code[0];
code = code[1];
k = k + 1;
}
if (tag == 0) {
toastLog("获取验证码超时或失败!");
return -1;
}
code = code.match(pat);
return code[0];
case "樱桃云":
// http://www.mangopt.com:9000/doApi/getMessage?sid=项目id&phone=取出来的手机号&token=登录时返回的令牌
var tag = 0;
var k = 0;
while (tag == 0 && k < Math.ceil(setOverTime / 3)) {
toastLog("未获取到短信,等待3秒重试!");
sleep(3000);
var r = http.get(yty_api + "getMessage?phone=" + phone + "&sid=" + Project_ID + "&token=" + LoginToken);
var code = r.body.string().split("|");
tag = code[0];
code = code[1];
k = k + 1;
}
if (tag == 0) {
toastLog("获取验证码超时或失败!");
return -1;
}
code = code.match(pat);
return code[0];
case "TheWolf":
var tag;
var k = 0;
while (tag != 0 && k < Math.ceil(setOverTime / 3)) {
toastLog("未获取到短信,等待3秒重试!");
sleep(3000);
var r = http.get(TheWolf_api + "clients/sms/getSms?token=" + LoginToken + "&project=" + Project_ID + "&number=" + phone + "&type=1");
r = r.body.json();
tag = r.errno;
k = k + 1;
}
if (tag == 0) {
var code = r.ret.tst;
log(code);
code = code.match(pat);
return code;
}
return -1;
default:
toast("未接入该接码平台!");
}
}
//释放手机号函数
function rec(phone) {
switch (接码平台) {
case "共享":
var r = http.get(gx_api + "cancelRecv&phone=" + phone + "&sid=" + Project_ID + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "火云":
var r = http.get(hy_api + "cancelRecv&sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "多米":
var r = http.get(dm_api + "cancelRecv&sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "短租":
var r = http.get(dz_api + "addIgnoreList&uid=" + Account_Api + "&token=" + LoginToken + "&mobiles=" + phone + "&pid=" + Project_ID);
var sfphone = r.body.string();
if (sfphone == 1) {
return 0;
} else {
return -1;
}
case "易码":
var r = http.get(ym_api + "release&token=" + LoginToken + "&itemid=" + Project_ID + "&mobile=" + phone);
var sfphone = r.body.string();
if (sfphone == "success") {
return 0;
} else {
return -1;
}
case "吸码皇":
// http://www.ximahuang.com/alz/api?action=cancelRecv&sid=项目id&phone=要释放的手机号&token=登录时返回的令牌
var r = http.get(xmh_api + "cancelRecv&sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "芒果云":
// http://www.mangopt.com:9000/doApi/cancelRecv?sid=项目id&phone=要释放的手机号&token=登录时返回的令牌
var r = http.get(mgy_api + "cancelRecv?sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "樱桃云":
// http://www.mangopt.com:9000/doApi/cancelRecv?sid=项目id&phone=要释放的手机号&token=登录时返回的令牌
var r = http.get(yty_api + "cancelRecv?sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "TheWolf":
var r = http.get(TheWolf_api + "clients/online/completeWork?token=" + LoginToken + "&phone=" + phone);
var r = r.body.json();
var errno = r.errno;
if (errno > 0) {
return -1;
} else if (errno == 0) {
return 0;
}
default:
toast("未接入该接码平台!");
}
}
//加黑手机号函数
function addBlacklist(phone) {
switch (接码平台) {
case "共享":
var r = http.get(gx_api + "addBlacklist&sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "火云":
var r = http.get(hy_api + "addBlacklist&sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "多米":
var r = http.get(dm_api + "addBlacklist&sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "短租":
var r = http.get(dz_api + "addIgnoreList&uid=" + Account_Api + "&token=" + LoginToken + "&mobiles=" + phone + "&pid=" + Project_ID);
var sfphone = r.body.string();
if (sfphone == 1) {
return 0;
} else {
return -1;
}
case "易码":
var r = http.get(ym_api + "addignore&token=" + LoginToken + "&itemid=" + Project_ID + "&mobile=" + phone);
var sfphone = r.body.string();
if (sfphone == "success") {
return 0;
} else {
return -1;
}
case "吸码皇":
// http://www.ximahuang.com/alz/api?action=addBlacklist&sid=项目id&phone=要加入黑名单的手机号&token=登录时返回的令牌
var r = http.get(xmh_api + "addBlacklist&sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "芒果云":
// http://www.cherryun.com:8000/doApi/addBlacklist?sid=项目id&phone=要加入黑名单的手机号&token=登录时返回的令牌
var r = http.get(mgy_api + "addBlacklist?sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
case "樱桃云":
// http://www.cherryun.com:8000/doApi/addBlacklist?sid=项目id&phone=要加入黑名单的手机号&token=登录时返回的令牌
var r = http.get(yty_api + "addBlacklist?sid=" + Project_ID + "&phone=" + phone + "&token=" + LoginToken);
var sfphone = r.body.string().split("|");
if (sfphone[0] == 1) {
return 0;
} else {
return -1;
}
default:
toast("未接入该接码平台!");
}
}
//讯代理优质
/*
** var 讯代理spiderId = "e1646d4003b34271a70a5bebc4abe56a";
** var 优质代理订单号 = "YZ20188168670Q4k4pr";
** xdaili_youzhi(讯代理spiderId,优质代理订单号);
*/
function xdaili_youzhi(spiderId, orderNo) {
var spId = spiderId; //spiderId
var odNo = orderNo; //订单号
var getIp_api = http.get('http://pv.sohu.com/cityjson?ie=utf-8');
var InetIP = getIp_api.body.string();
eval(InetIP);
log("代理前外网IP:" + returnCitySN.cip);
var xdailiUrl = "http://api.xdaili.cn/xdaili-api//greatRecharge/getGreatIp?spiderId=" + spId + "&orderno=" + odNo + "&returnType=2&count=1";
for (let i = 0; i < 3; i++) {
try {
var getProxy_json = http.get(xdailiUrl).body.json();
if (getProxy_json.ERRORCODE == "10036" || getProxy_json.ERRORCODE == "10038" || getProxy_json.ERRORCODE == "10055") {
throw {
"code": "-1",
"msg": "提取速度过快"
}
}
if (getProxy_json.ERRORCODE == "10036") {
throw {
"code": "-2",
"msg": "提取次数已达上限"
}
}
if (getProxy_json.ERRORCODE == "10063") {
throw {
"code": "-3",
"msg": "请输入正确的spiderId!"
}
}
if (getProxy_json.ERRORCODE == "10073") {
throw {
"code": "-4",
"msg": "订单不存在!"
}
}
break;
} catch (e) {
if (e.code == "-1") {
log(e.msg);
sleep(5000);
}
if (e.code == "-2") {
log(e.msg);
exit();
}
if (e.code == "-3") {
log(e.msg);
exit();
}
if (e.code == "-4") {
log(e.msg);
exit();
}
if (i == 2) { //运行3次后,没有拿到IP和端口 程序结束
log("发生了未知错误,请检查网络...");
exit();
}
}
}
var xdaili_proxyIP = getProxy_json.RESULT[0].ip;
var xdaili_proxyPort = parseInt(getProxy_json.RESULT[0].port);
httpProxy(xdaili_proxyIP, xdaili_proxyPort);
var getIp_api = http.get('http://pv.sohu.com/cityjson?ie=utf-8');
var InetIP = getIp_api.body.string();
eval(InetIP);
log("代理后外网IP:" + returnCitySN.cip);
}
function httpProxy(url, prot) {
var Proxy = java.net.Proxy;
var InetSocketAddress = java.net.InetSocketAddress;
var okhttp = new Packages.okhttp3.OkHttpClient.Builder().proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(url, prot)));
http.__okhttp__.muteClient(okhttp);
}
function lianzhong(e, t, a) {
http.__okhttp__.setTimeout(3e4);
var o = images.load(a),
r = images.toBase64(o, format = "png"),
i = device.release,
c = device.model,
s = device.buildId;
try {
var n = http.postJson("https://v2-api.jsdama.com/upload", {
softwareId: 11899,
softwareSecret: "Jyyh42S6ntMYzVK4msI1xQDpq2YJM7gMo0OtfoYp",
username: e,
password: t,
captchaData: r,
captchaType: 1001,
captchaMinLength: 0,
captchaMaxLength: 0,
workerTipsId: 0
}, {
headers: {
Host: "v2-api.jsdama.com",
Connection: "keep-alive",
"Content-Length": "298",
Accept: "application/json, text/javascript, */*; q=0.01",
"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",
"Content-Type": "text/json"
}
});
} 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;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化