File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 1
1
package leetcode
2
2
3
- import "strconv"
3
+ import (
4
+ "log"
5
+ "os"
6
+ "strconv"
7
+ )
4
8
5
9
func GetQuestionTranslation () (qt questionTranslationType ) {
6
10
jsonStr := `{
@@ -9,6 +13,12 @@ func GetQuestionTranslation() (qt questionTranslationType) {
9
13
"query": "query getQuestionTranslation($lang: String) {\n translations: allAppliedQuestionTranslations(lang: $lang) {\n title\n question {\n questionId\n __typename\n }\n __typename\n }\n}\n"
10
14
}`
11
15
graphQLRequest (questionTranslationFile , 2 , jsonStr , & qt )
16
+ if qt .Data .Translations == nil {
17
+ _ = os .Remove (getCachePath (questionTranslationFile ))
18
+ for _ , err := range qt .Errors {
19
+ log .Println (err .Message )
20
+ }
21
+ }
12
22
return
13
23
}
14
24
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ package leetcode
3
3
import (
4
4
"bytes"
5
5
"fmt"
6
+ "log"
7
+ "os"
6
8
"path"
7
9
"regexp"
8
10
"sort"
@@ -69,10 +71,16 @@ func GetTopicTag(slug string) (tt topicTagType) {
69
71
"variables": {
70
72
"slug": "` + slug + `"
71
73
},
72
- "query": "query getTopicTag($slug: String!) {\n topicTag(slug: $slug) {\n name\n translatedName\n questions {\n status\n questionId\n questionFrontendId\n title\n titleSlug\n translatedTitle\n stats\n difficulty\n isPaidOnly\n topicTags {\n name\n translatedName\n slug\n __typename\n }\n companyTags {\n name\n translatedName\n slug\n __typename\n }\n __typename\n }\n frequencies\n __typename\n }\n favoritesLists {\n publicFavorites {\n ...favoriteFields\n __typename\n }\n privateFavorites {\n ...favoriteFields\n __typename\n }\n __typename\n }\n}\n\nfragment favoriteFields on FavoriteNode {\n idHash\n id\n name\n isPublicFavorite\n viewCount\n creator\n isWatched\n questions {\n questionId\n title\n titleSlug\n __typename\n }\n __typename\n}\n"
74
+ "query": "query getTopicTag($slug: String!) {\n topicTag(slug: $slug) {\n name\n translatedName\n questions {\n status\n questionId\n questionFrontendId\n title\n titleSlug\n translatedTitle\n stats\n difficulty\n isPaidOnly\n topicTags {\n name\n translatedName\n slug\n __typename\n }\n __typename\n }\n frequencies\n __typename\n }\n favoritesLists {\n publicFavorites {\n ...favoriteFields\n __typename\n }\n privateFavorites {\n ...favoriteFields\n __typename\n }\n __typename\n }\n}\n\nfragment favoriteFields on FavoriteNode {\n idHash\n id\n name\n isPublicFavorite\n viewCount\n creator\n isWatched\n questions {\n questionId\n title\n titleSlug\n __typename\n }\n __typename\n}\n"
73
75
}`
74
76
filename := fmt .Sprintf (topicTagFile , slugToSnake (slug ))
75
77
graphQLRequest (filename , 2 , jsonStr , & tt )
78
+ if tt .Data .TopicTag .Name == "" {
79
+ _ = os .Remove (getCachePath (filename ))
80
+ for _ , err := range tt .Errors {
81
+ log .Println (slug , err .Message )
82
+ }
83
+ }
76
84
return
77
85
}
78
86
Original file line number Diff line number Diff line change 7
7
"github.com/openset/leetcode/internal/base"
8
8
)
9
9
10
- const version = "1.2 .0"
10
+ const version = "1.3 .0"
11
11
12
12
var CmdVersion = & base.Command {
13
13
Run : runVersion ,
You can’t perform that action at this time.
0 commit comments