Skip to content

Commit 0a59f0b

Browse files
author
Shuo
authored
Merge pull request #590 from openset/develop
Add: graphQLCnUrl
2 parents ad22bff + 2532c1d commit 0a59f0b

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed

Diff for: internal/leetcode/base.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var (
2525

2626
func graphQLRequest(filename string, days int, jsonStr string, v interface{}) {
2727
data := remember(filename, days, func() []byte {
28-
return client.PostJson(graphqlUrl, jsonStr)
28+
return client.PostJson(graphQL, jsonStr)
2929
})
3030
jsonDecode(data, &v)
3131
}

Diff for: internal/leetcode/config.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const (
88
apiProblemsShellUrl = "https://leetcode.com/api/problems/shell/"
99
problemsetAllUrl = "https://leetcode.com/problemset/all/"
1010
questionArticleUrl = "https://leetcode.com/articles/%s/"
11-
graphqlUrl = "https://leetcode-cn.com/graphql"
11+
graphQLUrl = "https://leetcode.com/graphql"
12+
graphQLCnUrl = "https://leetcode-cn.com/graphql"
1213
apiProgressAllUrl = "https://leetcode.com/api/progress/all/"
1314
submissionsLatestUrl = "https://leetcode.com/submissions/latest/"
1415
)
@@ -26,3 +27,5 @@ const (
2627
questionArticleFile = "question_article_%s.html"
2728
topicTagFile = "topic_tag_%s.json"
2829
)
30+
31+
var graphQL = graphQLCnUrl

Diff for: internal/leetcode/question_data.go

+5
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ func QuestionData(titleSlug string, isForce bool) (qd questionDataType) {
2828
graphQLRequest(filename, days, jsonStr, &qd)
2929
if qd.Data.Question.TitleSlug == "" {
3030
_ = os.Remove(getCachePath(filename))
31+
if graphQL == graphQLCnUrl {
32+
graphQL = graphQLUrl
33+
return QuestionData(titleSlug, isForce)
34+
}
3135
for _, err := range qd.Errors {
3236
log.Println(titleSlug, err.Message)
3337
}
3438
}
39+
graphQL = graphQLCnUrl
3540
return
3641
}
3742

Diff for: tag/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
| 11 | [Breadth-first Search](https://github.com/openset/leetcode/tree/master/tag/breadth-first-search/README.md) | [广度优先搜索](https://github.com/openset/leetcode/tree/master/tag/breadth-first-search/README.md) | | 12 | [Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md) | [](https://github.com/openset/leetcode/tree/master/tag/stack/README.md) |
1818
| 13 | [Backtracking](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md) | [回溯算法](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md) | | 14 | [Design](https://github.com/openset/leetcode/tree/master/tag/design/README.md) | [设计](https://github.com/openset/leetcode/tree/master/tag/design/README.md) |
1919
| 15 | [Linked List](https://github.com/openset/leetcode/tree/master/tag/linked-list/README.md) | [链表](https://github.com/openset/leetcode/tree/master/tag/linked-list/README.md) | | 16 | [Heap](https://github.com/openset/leetcode/tree/master/tag/heap/README.md) | [](https://github.com/openset/leetcode/tree/master/tag/heap/README.md) |
20-
| 17 | [Bit Manipulation](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md) | [位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md) | | 18 | [Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md) | [排序](https://github.com/openset/leetcode/tree/master/tag/sort/README.md) |
20+
| 17 | [Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md) | [排序](https://github.com/openset/leetcode/tree/master/tag/sort/README.md) | | 18 | [Bit Manipulation](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md) | [位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md) |
2121
| 19 | [Graph](https://github.com/openset/leetcode/tree/master/tag/graph/README.md) | [](https://github.com/openset/leetcode/tree/master/tag/graph/README.md) | | 20 | [Union Find](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md) | [并查集](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md) |
2222
| 21 | [Divide and Conquer](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md) | [分治算法](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md) | | 22 | [Trie](https://github.com/openset/leetcode/tree/master/tag/trie/README.md) | [字典树](https://github.com/openset/leetcode/tree/master/tag/trie/README.md) |
2323
| 23 | [Sliding Window](https://github.com/openset/leetcode/tree/master/tag/sliding-window/README.md) | [Sliding Window](https://github.com/openset/leetcode/tree/master/tag/sliding-window/README.md) | | 24 | [Recursion](https://github.com/openset/leetcode/tree/master/tag/recursion/README.md) | [递归](https://github.com/openset/leetcode/tree/master/tag/recursion/README.md) |

Diff for: tag/depth-first-search/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
| # | 题名 | 标签 | 难度 |
1111
| :-: | - | - | :-: |
12+
| 1080 | [根到叶路径上的不足节点](https://github.com/openset/leetcode/tree/master/problems/insufficient-nodes-in-root-to-leaf-paths) | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] | Medium |
1213
| 1061 | [按字典序排列最小的等效字符串](https://github.com/openset/leetcode/tree/master/problems/lexicographically-smallest-equivalent-string) 🔒 | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] [[并查集](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)] | Medium |
1314
| 1034 | [边框着色](https://github.com/openset/leetcode/tree/master/problems/coloring-a-border) | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] | Medium |
1415
| 1028 | [从先序遍历还原二叉树](https://github.com/openset/leetcode/tree/master/problems/recover-a-tree-from-preorder-traversal) | [[](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)] [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] | Hard |

Diff for: tag/tags.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@
7979
"Slug": "heap",
8080
"TranslatedName": ""
8181
},
82-
{
83-
"Name": "Bit Manipulation",
84-
"Slug": "bit-manipulation",
85-
"TranslatedName": "位运算"
86-
},
8782
{
8883
"Name": "Sort",
8984
"Slug": "sort",
9085
"TranslatedName": "排序"
9186
},
87+
{
88+
"Name": "Bit Manipulation",
89+
"Slug": "bit-manipulation",
90+
"TranslatedName": "位运算"
91+
},
9292
{
9393
"Name": "Graph",
9494
"Slug": "graph",

0 commit comments

Comments
 (0)