Skip to content

Commit 2d50949

Browse files
author
openset
committed
Update: QuestionData
1 parent dc9a3b9 commit 2d50949

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

internal/leetcode/question_data.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ func QuestionData(titleSlug string) (qd questionDataType) {
2121
}`
2222
filename := "question_data_" + strings.Replace(titleSlug, "-", "_", -1) + ".json"
2323
graphQLRequest(filename, 30, jsonStr, &qd)
24+
if qd.Data.Question.TitleSlug == "" {
25+
os.Remove(getCachePath(filename))
26+
for _, err := range qd.Errors {
27+
fmt.Println(titleSlug, err.Message)
28+
}
29+
}
2430
return
2531
}
2632

@@ -81,9 +87,11 @@ func (d difficultyStrType) Str() (s string) {
8187
}
8288

8389
func (question questionType) SaveContent() {
84-
fmt.Println(question.QuestionFrontendId, "\t"+question.Title, "saving...")
85-
filePutContents(question.getFilePath("README.md"), question.getDescContent())
86-
question.saveMysqlSchemas()
90+
if question.TitleSlug != "" {
91+
fmt.Println(question.QuestionFrontendId, "\t"+question.Title, "saving...")
92+
filePutContents(question.getFilePath("README.md"), question.getDescContent())
93+
question.saveMysqlSchemas()
94+
}
8795
}
8896

8997
func (question questionType) getDescContent() []byte {

0 commit comments

Comments
 (0)