Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 70567e5

Browse files
committed
helper 取消了自动下载的功能
1 parent 88f6d9b commit 70567e5

File tree

4 files changed

+51
-64
lines changed

4 files changed

+51
-64
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"exection",
99
"exention",
1010
"inention",
11+
"nbsp",
1112
"rorse",
1213
"stretchr"
1314
],

Helper/buildProblemDir.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,11 @@ func build(p problem) {
7474
creatREADME(p)
7575

7676
// 利用 chrome 打开题目页面
77-
go func() {
78-
cmd := exec.Command("google-chrome", p.link())
79-
_, err := cmd.Output()
80-
if err != nil {
81-
panic(err.Error())
82-
}
83-
}()
77+
cmd := exec.Command("google-chrome", p.link())
78+
_, err = cmd.Output()
79+
if err != nil {
80+
panic(err.Error())
81+
}
8482

8583
log.Printf("%d.%s 的文件夹,创建完毕。\n", p.ID, p.Title)
8684
}

Helper/problemReadme.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ func creatREADME(p problem) {
1515
%s
1616
`
1717

18-
questionDescription := strings.TrimSpace(getDescription(p.link()))
18+
// TODO: 复原自动下载的功能
19+
// questionDescription := strings.TrimSpace(getDescription(p.link()))
20+
questionDescription := ""
1921

2022
content := fmt.Sprintf(fileFormat, p.ID, p.Title, p.link(), questionDescription)
2123

@@ -27,20 +29,6 @@ func creatREADME(p problem) {
2729

2830
}
2931

30-
// func getDescription(url string) string {
31-
// doc, err := goquery.NewDocument(url)
32-
// if err != nil {
33-
// log.Fatal(err)
34-
// }
35-
// fmt.Println(doc.Html())
36-
// time.Sleep(10 * time.Second)
37-
// var desc string
38-
// doc.Find("meta[name=description]").Each(func(i int, selection *goquery.Selection) {
39-
// desc, _ = selection.Attr("content__1c40")
40-
// })
41-
// return desc
42-
// }
43-
4432
func replaceCharacters(s string) string {
4533
changeMap := map[string]string{
4634
""": "\"",

0 commit comments

Comments
 (0)