gofeed icon indicating copy to clipboard operation
gofeed copied to clipboard

Fix RSS enclosure parsing

Open sgodart opened this issue 2 years ago • 2 comments

Fix #217 Ignore all child node of , not only TextNodes.

sgodart avatar Dec 22 '23 11:12 sgodart

@sgodart can you include a test that demonstrates the issue at hand you are encountering?

I saw your issue you created. A test where it fails and is broken, and this PR fixes, would be much appreciated.

mmcdole avatar Dec 22 '23 20:12 mmcdole

Hey @mmcdole, thanks for your reply. Here is a code snippet to reproduce, you should see "Error parsing feed..." in stdout :

package main

import (
	"fmt"

	"github.com/mmcdole/gofeed"
)

func main() {
	parser := gofeed.NewParser()
	_, err := parser.ParseURL("https://sportauto.autojournal.fr/feed")

	if err != nil {
		fmt.Printf("Error parsing feed: %s\n", err.Error())
	} else {
		fmt.Printf("No error\n")
	}
}

The same snippet using this PR should output "No error", adding this statement in your go.mod:

replace github.com/mmcdole/gofeed => github.com/ividence/gofeed v1.2.2

sgodart avatar Jan 03 '24 10:01 sgodart

hey @mmcdole, any update on this?

sgodart avatar Feb 01 '24 10:02 sgodart

@sgodart greetings!

I appreciate the further details, but I was really asking for a new unit test, if you could, along with the patch.

They are specified with minimal feed representations and the expected output. So, for this, it would be a feed with an enclosure with a media tag (or similar), and then the specified parsed output.

https://github.com/mmcdole/gofeed/tree/master/testdata/parser/rss

That helps ensure any refactoring or future changes catch this issue as well and that we don't regress.

mmcdole avatar Feb 07 '24 04:02 mmcdole

Hey @mmcdole, thanks again for your help. I've added the test files. Have a nice day.

sgodart avatar Feb 07 '24 10:02 sgodart