diff --git a/internal/leetcode/base.go b/internal/leetcode/base.go index 796854f61..b1e053649 100644 --- a/internal/leetcode/base.go +++ b/internal/leetcode/base.go @@ -25,7 +25,7 @@ var ( func graphQLRequest(filename string, days int, jsonStr string, v interface{}) { data := remember(filename, days, func() []byte { - return client.PostJson(graphqlUrl, jsonStr) + return client.PostJson(graphQL, jsonStr) }) jsonDecode(data, &v) } diff --git a/internal/leetcode/config.go b/internal/leetcode/config.go index cc77044ef..0fbf09123 100644 --- a/internal/leetcode/config.go +++ b/internal/leetcode/config.go @@ -8,7 +8,8 @@ const ( apiProblemsShellUrl = "https://leetcode.com/api/problems/shell/" problemsetAllUrl = "https://leetcode.com/problemset/all/" questionArticleUrl = "https://leetcode.com/articles/%s/" - graphqlUrl = "https://leetcode-cn.com/graphql" + graphQLUrl = "https://leetcode.com/graphql" + graphQLCnUrl = "https://leetcode-cn.com/graphql" apiProgressAllUrl = "https://leetcode.com/api/progress/all/" submissionsLatestUrl = "https://leetcode.com/submissions/latest/" ) @@ -26,3 +27,5 @@ const ( questionArticleFile = "question_article_%s.html" topicTagFile = "topic_tag_%s.json" ) + +var graphQL = graphQLCnUrl diff --git a/internal/leetcode/question_data.go b/internal/leetcode/question_data.go index 12f063a6b..147675a27 100644 --- a/internal/leetcode/question_data.go +++ b/internal/leetcode/question_data.go @@ -28,10 +28,15 @@ func QuestionData(titleSlug string, isForce bool) (qd questionDataType) { graphQLRequest(filename, days, jsonStr, &qd) if qd.Data.Question.TitleSlug == "" { _ = os.Remove(getCachePath(filename)) + if graphQL == graphQLCnUrl { + graphQL = graphQLUrl + return QuestionData(titleSlug, isForce) + } for _, err := range qd.Errors { log.Println(titleSlug, err.Message) } } + graphQL = graphQLCnUrl return } diff --git a/tag/README.md b/tag/README.md index aea2bb5d2..343590160 100644 --- a/tag/README.md +++ b/tag/README.md @@ -17,7 +17,7 @@ | 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) | | 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) | | 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) | -| 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) | +| 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) | | 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) | | 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) | | 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 --git a/tag/depth-first-search/README.md b/tag/depth-first-search/README.md index ee34d0f2b..cd22417a6 100644 --- a/tag/depth-first-search/README.md +++ b/tag/depth-first-search/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 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 | | 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 | | 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 | | 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 --git a/tag/tags.json b/tag/tags.json index f7409d453..98cbeabd2 100644 --- a/tag/tags.json +++ b/tag/tags.json @@ -79,16 +79,16 @@ "Slug": "heap", "TranslatedName": "堆" }, - { - "Name": "Bit Manipulation", - "Slug": "bit-manipulation", - "TranslatedName": "位运算" - }, { "Name": "Sort", "Slug": "sort", "TranslatedName": "排序" }, + { + "Name": "Bit Manipulation", + "Slug": "bit-manipulation", + "TranslatedName": "位运算" + }, { "Name": "Graph", "Slug": "graph",