Skip to content

Commit

Permalink
fix date get error.
Browse files Browse the repository at this point in the history
  • Loading branch information
wedojava committed Sep 29, 2020
1 parent 6741378 commit 9042e38
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ Fetch depth: 1
There files need to be modified while add a new site:
- main.go: add entrance url
- links.go -> SetLinks(): add case about target urls feature regex, eg: if url must have `about`, param 2 is `.*?about.*`
- post.go -> TreatPost(): add case for new site domain.
- site/newsite: copy files from sibling folder, then develop and pass the test.
- post.go -> TreatPost(): add case for new site domain.
3 changes: 2 additions & 1 deletion internal/fetcher/fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ func TestCrawl(t *testing.T) {
// "https://www.zaobao.com/news/world",
// "https://www.voachinese.com",
// "https://www.rfa.org/mandarin/",
"https://news.ltn.com.tw/list/breakingnews",
// "https://news.ltn.com.tw/list/breakingnews",
"https://www.cna.com.tw/list/aall.aspx",
})

log.Println("Sleep a sec ...")
Expand Down
2 changes: 1 addition & 1 deletion internal/fetcher/sites/cna/cna.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func setDate(p *Post) error {
}
tY := cs[0][:4]
tM := cs[0][5:7]
tD := cs[0][7:9]
tD := cs[0][8:10]
tH := cs[0][11:13]
tm := cs[0][14:16]
yy, err := strconv.Atoi(tY)
Expand Down
2 changes: 1 addition & 1 deletion internal/fetcher/sites/cna/cna_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestSetDate(t *testing.T) {
if err := setDate(p); err != nil {
t.Errorf("test SetPost err: %v", doc)
}
want := "2020-08-31T11:49:00+08:00"
want := "2020-09-29T11:49:00+08:00"
if p.Date != want {
t.Errorf("\ngot: %v\nwant: %v", p.Date, want)
}
Expand Down

0 comments on commit 9042e38

Please # to comment.