Link w/o href considered alternate unconditionally
Rongronggg9 opened this issue · 0 comments
Rongronggg9 commented
Consider an Atom entry like this (from https://www.dday.it/rss):
<entry>
<id>https://www.dmove.it/news/monopattini-xiaomi</id>
<published>2023-05-22T14:31:00+02:00</published>
<updated>2023-05-22T14:41:04+02:00</updated>
<link rel="alternate" type="text/html" href="https://www.dmove.it/news/monopattini-xiaomi"/>
<link rel="enclosure" type="image/jpeg">https://dday.imgix.net/system/uploads/news/square_crop_img/45938/7b5b5a_Xiaomi_Quad.jpg?w=329&h=256&fit=crop&auto=format%2Ccompress&s=202aae143e9fc13b47e2c8511f2bc7db</link>
<title>Xiaomi espande la gamma di monopattini: oltre al Pro, ora ci sono anche l’Electric Scooter 4 e il 4 Lite</title>
<content type="html"><img src='https://dday.imgix.net/system/uploads/news/square_crop_img/45938/7b5b5a_Xiaomi_Quad.jpg?w=329&h=256&fit=crop&auto=format%2Ccompress&s=202aae143e9fc13b47e2c8511f2bc7db'></br>Xiaomi ha annunciato nuovi prodotto della gamma con due soluzioni più economiche. Electric Scooter 4 ed Electric Scooter 4 saranno disponibili dal 12 giugno.<a href='https://www.dmove.it/news/monopattini-xiaomi'>... Leggi tutto</a></content>
<author>
<name>dmove</name>
</author>
</entry>
import feedparser
d = feedparser.parse(f'<feed>{entry}</feed>')
assert d.entries[0].link == 'https://dday.imgix.net/system/uploads/news/square_crop_img/45938/7b5b5a_Xiaomi_Quad.jpg?w=329&h=256&fit=crop&auto=format%2Ccompress&s=202aae143e9fc13b47e2c8511f2bc7db'
The element <link rel="enclosure" type="image/jpeg">
is misformatted, superseding <link rel="alternate" type="text/html" href="https://www.dmove.it/news/monopattini-xiaomi"/>
to become entry.link
. In theory, the rel="alternate"
link should have the highest priority.