mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Ignore RSS articles with non-unique identifiers
This commit is contained in:
parent
d710bbd9ef
commit
68ee071331
@ -583,6 +583,7 @@ void Parser::parse_impl(const QByteArray &feedData)
|
|||||||
|
|
||||||
emit finished(m_result);
|
emit finished(m_result);
|
||||||
m_result.articles.clear(); // clear articles only
|
m_result.articles.clear(); // clear articles only
|
||||||
|
m_articleIDs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::parseRssArticle(QXmlStreamReader &xml)
|
void Parser::parseRssArticle(QXmlStreamReader &xml)
|
||||||
@ -774,6 +775,20 @@ void Parser::addArticle(QVariantHash article)
|
|||||||
if (localId.toString().isEmpty())
|
if (localId.toString().isEmpty())
|
||||||
localId = article.value(Article::KeyTitle);
|
localId = article.value(Article::KeyTitle);
|
||||||
|
|
||||||
if (!localId.toString().isEmpty())
|
if (localId.toString().isEmpty()) {
|
||||||
m_result.articles.prepend(article);
|
// The article could not be uniquely identified
|
||||||
|
// since it has no appropriate data.
|
||||||
|
// Just ignore it.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_articleIDs.contains(localId.toString())) {
|
||||||
|
// The article could not be uniquely identified
|
||||||
|
// since the Feed has duplicate identifiers.
|
||||||
|
// Just ignore it.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_articleIDs.insert(localId.toString());
|
||||||
|
m_result.articles.prepend(article);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QSet>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVariantHash>
|
#include <QVariantHash>
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ namespace RSS
|
|||||||
|
|
||||||
QString m_baseUrl;
|
QString m_baseUrl;
|
||||||
ParsingResult m_result;
|
ParsingResult m_result;
|
||||||
|
QSet<QString> m_articleIDs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user