完善
This commit is contained in:
parent
21f872d77c
commit
5a4d808f89
17
main.go
17
main.go
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
str "github.com/fthvgb1/wp-go/helper/strings"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
|
@ -62,39 +63,45 @@ func penti(w http.ResponseWriter, req *http.Request) {
|
|||
|
||||
func zhihuDaily(w http.ResponseWriter, req *http.Request) {
|
||||
io.WriteString(w, fetch("https://feedx.best/rss/zhihudaily.xml", func(s string) string {
|
||||
return filterItem(s, time.Now(), 1)
|
||||
return filterItem(s, time.Now(), recentDay)
|
||||
}))
|
||||
}
|
||||
|
||||
func tjxz(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
io.WriteString(w, fetch("https://feedx.best/rss/tjxz.xml", func(s string) string {
|
||||
return filterItem(s, time.Now(), 1)
|
||||
return filterItem(s, time.Now(), recentDay)
|
||||
}))
|
||||
}
|
||||
func bbcLearn(w http.ResponseWriter, _ *http.Request) {
|
||||
io.WriteString(w, fetch("https://www.bbc.co.uk/learningenglish/chinese", func(s string) string {
|
||||
return bbclearn.LearnParse(s, 1)
|
||||
return bbclearn.LearnParse(s, recentDay)
|
||||
}))
|
||||
}
|
||||
|
||||
func theNewYorker(w http.ResponseWriter, r *http.Request) {
|
||||
io.WriteString(w, fetch("https://feedx.best/rss/newyorker.xml", func(s string) string {
|
||||
return filterItem(s, time.Now(), 1)
|
||||
return filterItem(s, time.Now(), recentDay)
|
||||
}))
|
||||
}
|
||||
|
||||
func voaLearnEnglish(w http.ResponseWriter, r *http.Request) {
|
||||
io.WriteString(w, fetch("https://feedx.best/rss/voalearningenglish.xml", func(s string) string {
|
||||
return filterItem(s, time.Now(), 1)
|
||||
return filterItem(s, time.Now(), recentDay)
|
||||
}))
|
||||
}
|
||||
|
||||
var recentDay = 1
|
||||
|
||||
func main() {
|
||||
port := os.Getenv("port")
|
||||
if port == "" {
|
||||
port = ":80"
|
||||
}
|
||||
day := os.Getenv("rss_recent_day")
|
||||
if day != "" {
|
||||
recentDay = str.ToInt[int](day)
|
||||
}
|
||||
time.Local = time.FixedZone("CST", 3600*8)
|
||||
http.HandleFunc("/pentitugua", penti) //喷嚏图挂
|
||||
http.HandleFunc("/zhihuDaily", zhihuDaily) //知乎日报
|
||||
|
|
Loading…
Reference in New Issue
Block a user