优化
This commit is contained in:
parent
e10527c3d2
commit
8e30297639
6
main.go
6
main.go
|
@ -31,12 +31,12 @@ func fetch(u string, fn ...func(s string) string) string {
|
|||
return html
|
||||
}
|
||||
|
||||
func dayLimit(today, forwardDay int, s string) string {
|
||||
func dayLimit(today, forwardDay int, s, format string) string {
|
||||
da := date.FindStringSubmatch(s)
|
||||
if len(da) <= 1 {
|
||||
return s
|
||||
}
|
||||
t, err := time.Parse(time.RFC1123Z, da[1])
|
||||
t, err := time.Parse(format, da[1])
|
||||
if err != nil {
|
||||
return s
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ func dayLimit(today, forwardDay int, s string) string {
|
|||
|
||||
func filterItem(html string, today, recentDay int) string {
|
||||
return zhihuReg.ReplaceAllStringFunc(html, func(s string) string {
|
||||
return dayLimit(today, recentDay, s)
|
||||
return dayLimit(today, recentDay, s, time.RFC1123Z)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user