mmcdole / gofeed

Parse RSS, Atom and JSON feeds in Go
MIT License
2.56k stars 208 forks source link

Failed to detect feed type on https://storyfm.cn/feed/episodes #170

Closed gozelus closed 3 years ago

gozelus commented 3 years ago
resp, _ := http.Get("https://storyfm.cn/feed/episodes")
t := gofeed.DetectFeedType(resp.Body)
fmt.Println(t)

Expected behavior

it prints 0

Actual behavior

should print FeedTypeRSS


gofeed.NewParser().ParseURL("https://storyfm.cn/feed/episodes")

return error, but

resp, _ := http.Get("https://storyfm.cn/feed/episodes")
f, err := rss.Parser{}.Parse(resp.Body)

works fine.

gozelus commented 3 years ago

I have found the reason, the HTML file contains the bom lead to parse failure. Is it possible to solve this problem?

makew0rld commented 3 years ago

I believe the master branch has a fix for this, see #158 and https://github.com/mmcdole/gofeed/commit/d5ae83954e0552f161c04d5d1835d20f82950916.

gozelus commented 3 years ago

I have found the reason, the HTML file contains the bom lead to parse failure. Is it possible to solve this problem?

It fixed, thanks so much !