mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-24 21:44:25 +00:00
Merge pull request #10514 from Mataniko/rss-enclosure-type
Download RSS "enclosure" element if no proper MIME type is found
This commit is contained in:
commit
af7d8f6a43
@ -588,6 +588,7 @@ void Parser::parse_impl(const QByteArray &feedData)
|
|||||||
void Parser::parseRssArticle(QXmlStreamReader &xml)
|
void Parser::parseRssArticle(QXmlStreamReader &xml)
|
||||||
{
|
{
|
||||||
QVariantHash article;
|
QVariantHash article;
|
||||||
|
QString altTorrentUrl;
|
||||||
|
|
||||||
while (!xml.atEnd()) {
|
while (!xml.atEnd()) {
|
||||||
xml.readNext();
|
xml.readNext();
|
||||||
@ -603,6 +604,8 @@ void Parser::parseRssArticle(QXmlStreamReader &xml)
|
|||||||
else if (name == QLatin1String("enclosure")) {
|
else if (name == QLatin1String("enclosure")) {
|
||||||
if (xml.attributes().value("type") == QLatin1String("application/x-bittorrent"))
|
if (xml.attributes().value("type") == QLatin1String("application/x-bittorrent"))
|
||||||
article[Article::KeyTorrentURL] = xml.attributes().value(QLatin1String("url")).toString();
|
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")) {
|
else if (name == QLatin1String("link")) {
|
||||||
const QString text {xml.readElementText().trimmed()};
|
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);
|
m_result.articles.prepend(article);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user