parse rss 0.91

This commit is contained in:
mmacia committed 2026-09-23 21:29:06 +00:00
1 parent 849ef90d19
commit 7200ef5215
2 files changed
+2 -1

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ defmodule FeedReader.Formats.RSS do
@impl true
def matches_prefix?(prefix) do
Regex.match?(~r/<rss\b[^>]*\bversion\s*=\s*(["'])2\.0\1/is, prefix)
Regex.match?(~r/<rss\b[^>]*\bversion\s*=\s*(["'])(?:0\.9(?:1|2)?|2\.0)\1/is, prefix)
end
@impl true
@@ -5,6 +5,7 @@ defmodule FeedReader.FormatDetectionTest do
test "detects RSS, Atom, and RDF from a bounded XML prefix" do
assert FeedReader.detect_format("<?xml version='1.0'?><rss version='2.0'>") == :rss
assert FeedReader.detect_format("<rss version='0.91'>") == :rss
assert FeedReader.detect_format("<feed xmlns='http://www.w3.org/2005/Atom'>") == :atom
assert FeedReader.detect_format("<rdf:RDF xmlns:rdf='urn:rdf'>") == :rdf
assert FeedReader.detect_format("<html><body>not a feed</body></html>") == :unknown