mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-03 03:20:22 +03:00
Download RSS enclosure element if no proper MIME type is found
In the case where an RSS feed doesn't have the "enclosure" element with type "application/x-bittorrent", fallback to the last enclosure element which has no "type" attribute.
This commit is contained in:
parent
18be4732b3
commit
bd2d636bb5
1 changed files with 6 additions and 0 deletions
|
@ -588,6 +588,7 @@ void Parser::parse_impl(const QByteArray &feedData)
|
|||
void Parser::parseRssArticle(QXmlStreamReader &xml)
|
||||
{
|
||||
QVariantHash article;
|
||||
QString altTorrentUrl;
|
||||
|
||||
while (!xml.atEnd()) {
|
||||
xml.readNext();
|
||||
|
@ -603,6 +604,8 @@ void Parser::parseRssArticle(QXmlStreamReader &xml)
|
|||
else if (name == QLatin1String("enclosure")) {
|
||||
if (xml.attributes().value("type") == QLatin1String("application/x-bittorrent"))
|
||||
article[Article::KeyTorrentURL] = xml.attributes().value(QLatin1String("url")).toString();
|
||||
else if (xml.attributes().value("type").isEmpty())
|
||||
altTorrentUrl = xml.attributes().value(QLatin1String("url")).toString();
|
||||
}
|
||||
else if (name == QLatin1String("link")) {
|
||||
const QString text {xml.readElementText().trimmed()};
|
||||
|
@ -629,6 +632,9 @@ void Parser::parseRssArticle(QXmlStreamReader &xml)
|
|||
}
|
||||
}
|
||||
|
||||
if (article[Article::KeyTorrentURL].toString().isEmpty())
|
||||
article[Article::KeyTorrentURL] = altTorrentUrl;
|
||||
|
||||
m_result.articles.prepend(article);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue