This blog introduces a method for completing Hanmu on the Sunshine Sports platform using HTTP requests. Compared to virtual positioning, this method is faster and more convenient.
This blog is inspired by Senior Li Ye’s project. Click here to visit the project.
Login Process
The login process is about acquiring the token
. During this process, the user’s IMEI
is required.
IMEI
is a 32-bit hexadecimal number that can be captured during the login process on the Sunshine Sports platform.
During the login process, we need to pass the IMEI
as a parameter, like this:
http://client3.aipao.me/api/{token}/QM_Users/Login_AndroidSchool?IMEICode=00000000000000000000000000000000
At the same time, we need to include the current version of LePao (version
) in the header. Usually, the version is 2.40.
This HTTP request will fetch a json
, where the token
under Data
is the value we need to obtain.
Applying for a Run
The running process requires a request based on the previously obtained token
. The link and parameters for the request are as follows:
http://client3.aipao.me/api/{token}/QM_Runs/SRS?S1=30.534737&S2=114.367785&S3=2000
You can notice that there are three parameters: S1, S2, and S3, representing the latitude and longitude of the running location and the distance respectively.
The parameters used in the above link represent the track of the Wuhan University Information School playground and a 2000-meter distance.
After sending this request, you will receive a RunId
and enter the running state.
Ending the Run
In Li Ye’s code, there is a process of waiting for the run to finish. This is to ensure the accuracy and consistency of the data. However, in practical testing, we found that we don’t actually need to wait for the run to finish. We can directly request the end of the run to submit the Hanmu result.
The link for this request is as follows:
http://client3.aipao.me/api/{token}/QM_Runs/ES
At this point, several parameters need to be submitted, let’s explain them one by one:
Parameter | Meaning |
---|---|
S1 | RunId obtained during the run application |
S4 | Time spent on running, reasonable value |
S5 | Actual running distance, usually 1 to 2 meters more than the theoretical distance |
S8 | Password table, will be explained later |
S9 | Number of steps, reasonable value |
Password Table
In the parameters for ending the run, all integer parameters are encrypted using a password table. The principle is similar to the Caesar cipher, where numbers and letters correspond one-to-one. When submitting, both the ciphertext and the password table are submitted simultaneously.
When submitting, we must ensure that the password table corresponds correctly to the numbers for successful submission.
Here’s an example of encrypting the running distance:
Actual Value | Encrypted Value | Password Table |
---|---|---|
2000 | caaa | abcdefghijklmnopqrstuvwxyz |
246 | oqs | mnopqrstuvwxyzabcdefghijkl |