You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**This project is for study and exchange only, and under no circumstances shall it be used for any commercial purposes. If you violate the statement, you are responsible for the consequences, and I do not assume any responsibility.**
22
19
23
-
## 项目总览
24
-
25
-
本项目提供的是 **力扣** 官方网站的 **WebApi** 集合,提出的 Api 均已试验成功。
20
+
## Project Overview
26
21
27
22
This project provides the **WebApi** collection of **Leetcode**, and the proposed Api has been successfully tested.
Leetcode uses [**GraphQL**](https://graphql.org/) technology to obtain data, that is, the mode of **on-demand data distribution**. At the same time, all network requests need to be attached with Cookie access, and some network requests need to confirm whether the **Referer** belongs to Leetcode domain name. Develop a solution before using these WebApis.
52
39
53
-
### 部分解决方案
40
+
### Partial Solution
54
41
55
-
在传统的 HTML5 项目中,如:
56
42
In traditional HTML5 projects, such as:
57
43
58
44
```html
@@ -65,16 +51,10 @@ In traditional HTML5 projects, such as:
In such projects, due to the safety and risk of forgery of the Referer, it is generally not allowed to modify the items in the HttpRequest header, i.e. the items in the RequestHeader, which contain the Referer item.
In Vue-Cil project, the Webpack **DevProxy** item can be used to set up the relevant request headers, thus creating the effect of faking the Referer for data.
There are many such examples on the Internet, and I won't repeat them all here. Recently, I was writing a new [**Electron**](https://www.electronjs.org/) project, which used the function of forging Referer. Here I can give some examples.
In the given instantiated object, all function methods return [**axios**](https://www.axios-http.cn/) objects. So, you can get data from the function's **then** callback, for example:
96
74
97
75
```javascript
@@ -116,29 +94,21 @@ const { session } = remote,
116
94
}
117
95
```
118
96
119
-
相关的文档请移步相关技术或者自行查询。
120
-
121
97
For related documents, refer to related technologies or query them by yourself.
122
98
123
-
## 接口详情
124
-
125
-
所有接口在文档更新时均已通过测试。
99
+
## Interface Detail
126
100
127
101
All interfaces were tested when the document was updated.
The Cookie items mentioned in the table below refer to the **LEETCODE_SESSION** and **x-csrftoken** items generated when users log in to the official website of Leetcode. The method of obtaining them is as follows: After logging in successfully using the browser, open the network item in the developer tool and look for the graphQL request in the successful state. The values of the two items can be found in the request information.
132
104
133
-
### 用户状态
105
+
### User Status
134
106
135
107
```javascript
136
108
const$leetcode=new$Leetcode()
137
109
;$leetcode.getUserStatus() // with cookie [LEETCODE_SESSION,x-csrftoken]
0 commit comments