Skip to content

Commit 08bd262

Browse files
committed
feat: update spider
1 parent 5284f9f commit 08bd262

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

lcci/lcci.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

solution/t.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import requests
2+
import urllib3
3+
4+
urllib3.disable_warnings()
5+
6+
query_list_en = """
7+
query problemsetQuestionList($categorySlug: String, $limit: Int, $skip: Int, $filters: QuestionListFilterInput) {
8+
problemsetQuestionList: questionList(
9+
categorySlug: $categorySlug
10+
limit: $limit
11+
skip: $skip
12+
filters: $filters
13+
) {
14+
total: totalNum
15+
questions: data {
16+
acRate
17+
difficulty
18+
freqBar
19+
frontendQuestionId: questionFrontendId
20+
isFavor
21+
paidOnly: isPaidOnly
22+
status
23+
title
24+
titleSlug
25+
topicTags {
26+
name
27+
id
28+
slug
29+
}
30+
hasSolution
31+
hasVideoSolution
32+
}
33+
}
34+
}
35+
"""
36+
37+
question_list_query = {
38+
'operationName': 'problemsetQuestionList',
39+
'query': query_list_en,
40+
'variables': {
41+
'categorySlug': 'all-code-essentials',
42+
'filters': {"orderBy": "FRONTEND_ID", "sortOrder": "DESCENDING"},
43+
'limit': 10000,
44+
'skip': 0,
45+
},
46+
}
47+
48+
# 获取所有题目 slugs
49+
url_en = 'https://leetcode.com/graphql'
50+
res = requests.post(url_en, json=question_list_query, timeout=20, verify=False)

0 commit comments

Comments
 (0)