cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
UersK
Level III

How to implement JS algorithm with JSL?

There is a website data request to download the need for dynamic verification, web page JS has a specific algorithm.

function getRnd() {
    return parseInt(Math.random() * 10000) + "=" + parseInt(Math.random() * 10000)
}
//Returns a random number


function getRuntime() {
    var c = new Date();
    var b = "";
    var f = c.getFullYear();
    var h = c.getMonth() + 1;
    var g = c.getDate();
    var a = c.getHours();
    var d = c.getMinutes();
    var e = c.getSeconds();
    b = f + "-" + h + "-" + g + " " + a + ":" + d + ":" + e;
    return
//Returns a timestamp

Its request parameter is

[{"ReqId":"1000","Market":"0","Sort":"zj08","CodeList":"","Desc":"1","Page":"1","PageSize":"100","Xgtj":"","Want":"hq00,hq01,zj00,zj01,zj02,zj03,zj04,zj05,zj06,zj07,zj08,zj09,zj10,zj11,zj12,zj13,zjn00,zjn01,zjn02","EXPTOKEN":"35de5f29c393b370e92a99c19ea2bb8f9a5d81e0296dedf6d952531a0982450e","modname":"mod_zjlx"}]

 

 

9 REPLIES 9
UersK
Level III

Re: How to implement JS algorithm with JSL?

The token is dynamic, and the 32 bits in the figure are the real-time timestamp when the data is requested, which is calculated according to the above algorithm

208160837.png

 

How to use JSL to achieve this algorithm, the final use of JSL can achieve the website data download.

 

Thanks Experts!

UersK
Level III

Re: How to implement JS algorithm with JSL?

b3313cca81a3f56de75d0e252dc3d17d	{~62~33~33~31~33~63~63~61~38~31~61~33~66~35~36~64~65~37~35~64~30~65~32~35~32~64~63~33~64~31~37~64};
b3313cca81a3f56dca5503f02eb3b23f	{~62~33~33~31~33~63~63~61~38~31~61~33~66~35~36~64~63~61~35~35~30~33~66~30~32~65~62~33~62~32~33~66};
54b0ea31266538a5ed4b311f78e45577	{~35~34~62~30~65~61~33~31~32~36~36~35~33~38~61~35~65~64~34~62~33~31~31~66~37~38~65~34~35~35~37~37};
54b0ea31266538a5dc3eb30831ba9a8e	{~35~34~62~30~65~61~33~31~32~36~36~35~33~38~61~35~64~63~33~65~62~33~30~38~33~31~62~61~39~61~38~65};
6f6513e99b16e00bd952531a0982450e	{~36~66~36~35~31~33~65~39~39~62~31~36~65~30~30~62~64~39~35~32~35~33~31~61~30~39~38~32~34~35~30~65};
230e438970e32162d952531a0982450e	{~32~33~30~65~34~33~38~39~37~30~65~33~32~31~36~32~64~39~35~32~35~33~31~61~30~39~38~32~34~35~30~65};
3a37657866190524d952531a0982450e	{~33~61~33~37~36~35~37~38~36~36~31~39~30~35~32~34~64~39~35~32~35~33~31~61~30~39~38~32~34~35~30~65};
762baf39305e1ed6d952531a0982450e	{~37~36~32~62~61~66~33~39~33~30~35~65~31~65~64~36~64~39~35~32~35~33~31~61~30~39~38~32~34~35~30~65};
16f080f9e5d542afd952531a0982450e	{~31~36~66~30~38~30~66~39~65~35~64~35~34~32~61~66~64~39~35~32~35~33~31~61~30~39~38~32~34~35~30~65};
478a2b0371d01b8cd952531a0982450e	{~34~37~38~61~32~62~30~33~37~31~64~30~31~62~38~63~64~39~35~32~35~33~31~61~30~39~38~32~34~35~30~65};

I collected the timestamp and its binary text for several different time request parameters.

2023-02-08_16-18-45.png

I just don't know how to use JSL to do this algorithm.Ask a JMP expert for help.Thanks!

 

UersK
Level III

Re: How to implement JS algorithm with JSL?

  • I'm trying to analyze it this way

 

UersK
Level III

Re: How to implement JS algorithm with JSL?

  • Is there a function for JMP?

Thanks Experts!

Re: How to implement JS algorithm with JSL?

You should provide more background information if you expect any help here. So you have an algorithm coded in JavaScript? Have you learned JSL yet? What is the nature of the problem you have encountered so far?

UersK
Level III

Re: How to implement JS algorithm with JSL?

 

Thanks Experts!

Yes, this is an HTTP download problem with JSL, and this algorithm only involves timestamp verification of request parameters.

I JSL manual, can do normal HTTP using JSL download data.

jthi
Super User

Re: How to implement JS algorithm with JSL?

JSL does offer wide range of different functions related to datetimes

jthi_0-1676103843909.png

and then maybe you can use character functions to build rest of your string

jthi_2-1676104099112.png

and HTTP Request functions to build your query

jthi_3-1676104176093.png

 

 

-Jarmo
UersK
Level III

Re: How to implement JS algorithm with JSL?

Thank jthi!

 

Still in the HTTP request time check problem, this parameter must be submitted at the time according to the above JS algorithm to successfully download the data.

My complete download of the JSL code is pictured.

 

2023-02-11_17-44-40.png

UersK
Level III

Re: How to implement JS algorithm with JSL?

fiddler

2023-02-11_17-55-12.png

Different time demands, to change only timestamp this part

Thanks Experts!