Quickly convert browser copy to JSL code with EmEditor's replacement feature
CURL (CMD) is copied from the browser F12 and quickly converted to JSL code with the EmEditor replacement function.
Of course, this process should also be implemented with JSL.
cURL(cmd)
curl "http://excalc" -H "Connection: keep-alive" -H "Origin: http://excalc.icfqs.com:7616" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" -H "Content-Type: text/plain" -H "Accept: */*" -H "Referer: http://excalc.icfqs.com:7616/site/tdx-zbfx/page-ddlj.html?setcode=1^&code=xxxxxx^&name=ssssss^&color=0" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7" -H "Cookie: ASPSessionID=" --data-binary "^[^{^\^"funcId^\^":2,^\^"offset^\^":0,^\^"count^\^":200,^\^"cond^\^":^\^"time,11700,33600^|amount,14^\^",^\^"modname^\^":^\^"TickAly^\^"^}^]" --compressed --insecure
EmEditor
document.selection.Replace("\\r","\\n",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\\n\\n","\\n",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace(" -H ","\\n",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("curl \"(.{0,})$","u=\"\\1;h=[=>];//h[\"Content-Type\"]=\"application/json\";",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace(" --compressed","\\n--compressed",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace(" --data(.[^\"]{0,})(.{0,})$","\\njj=\\2;",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
//document.selection.Replace("\"cookie: (.{0,})$","h[\"cookie\"]=\"\\1;",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"cookie: (.{0,})$","h[\"cookie\"]=\"\\1;\\nzzzrs=New HTTP Request(URL(u),Method(\"GET\"),Headers(h));//rs=New HTTP Request(URL(u),Method(\"POST\"),JSON(jj),Headers(h));\\nr=rs<<Send;txt=(Blob To Char(r));t1=\"[{\";off1=Contains(txt,t1);If(off1,tx=SubStr(txt,off1,Length(txt)));t2=\"}]\";off2=Contains(tx,t2,-1);If(off2,tx=SubStr(tx,1,off2+1));\\ndt=jsontodatatable(tx);",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Accept: (.{0,})$","//h[\"ac\"]=\"\\1;",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"User-Agent: (.{0,})$","//h[\"User-Agent\"]=\"\\1;",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Connection:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Origin:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Connection:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Origin:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"X-Requested-With:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Content-Type:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Sec-Fetch-Site:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Sec-Fetch-Mode:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Referer:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Accept-Encoding:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\"Accept-Language:(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("--compressed(.{0,})$","",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\\n\\n","\\n",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\\n\\n","\\n",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\\n\\n","\\n",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("\\n\\n","\\n",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("zzz","\\n",eeReplaceAll | eeFindReplaceRegExp,eeExFindSeparateCRLF);
document.selection.Replace("^[","[",eeReplaceAll,0);
document.selection.Replace("^{","{",eeReplaceAll,0);
document.selection.Replace("^]","]",eeReplaceAll,0);
document.selection.Replace("^}","}",eeReplaceAll,0);
document.selection.Replace("^\\^\"","\\!\"",eeReplaceAll,0);
document.selection.Replace("^|","|",eeReplaceAll,0);
document.selection.SelectAll();
document.selection.Copy(eeCopyUnicode);
JSL(Not finishing)
u="http://excalc";h=[=>];//h["Content-Type"]="application/json";
//h["User-Agent"]="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36";
//h["ac"]="*/*";
h["cookie"]="ASPSessionID=";
rs=New HTTP Request(URL(u),Method("GET"),Headers(h));//rs=New HTTP Request(URL(u),Method("POST"),JSON(jj),Headers(h));
r=rs<<Send;txt=(Blob To Char(r));t1="[{";off1=Contains(txt,t1);If(off1,tx=SubStr(txt,off1,Length(txt)));t2="}]";off2=Contains(tx,t2,-1);If(off2,tx=SubStr(tx,1,off2+1));
dt=jsontodatatable(tx);
jj="[{\!"funcId\!":2,\!"offset\!":0,\!"count\!":200,\!"cond\!":\!"time,11700,33600|amount,14\!",\!"modname\!":\!"TickAly\!"}]";