feat: add external site parser worker
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from app import parse_rss
|
||||
|
||||
|
||||
def test_parse_rss() -> None:
|
||||
xml = """<rss><channel><item><guid>1</guid><title>Title</title>
|
||||
<link>https://example.test/1</link>
|
||||
<description><p>Body</p><img src="https://example.test/1.jpg"></description>
|
||||
<pubDate>Mon, 10 Aug 2026 10:00:00 +0000</pubDate></item></channel></rss>"""
|
||||
item = parse_rss(xml, 20)[0]
|
||||
assert item.external_id == "1"
|
||||
assert item.text == "Body"
|
||||
assert item.media[0]["url"] == "https://example.test/1.jpg"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_parse_rss()
|
||||
Reference in New Issue
Block a user