mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-31 03:50:20 -07:00
Fix RSS parsing
This commit is contained in:
parent
c40801ce99
commit
12280c6a0f
2 changed files with 46 additions and 44 deletions
|
@ -221,9 +221,13 @@ RssArticlePtr xmlToRssArticle(RssFeed* parent, QXmlStreamReader& xml)
|
||||||
QDateTime date;
|
QDateTime date;
|
||||||
QString author;
|
QString author;
|
||||||
|
|
||||||
Q_ASSERT(xml.isStartElement() && xml.name() == "item");
|
while(!xml.atEnd()) {
|
||||||
|
xml.readNext();
|
||||||
|
|
||||||
while (xml.readNextStartElement()) {
|
if(xml.isEndElement() && xml.name() == "item")
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (xml.isStartElement()) {
|
||||||
if (xml.name() == "title")
|
if (xml.name() == "title")
|
||||||
title = xml.readElementText();
|
title = xml.readElementText();
|
||||||
else if (xml.name() == "enclosure") {
|
else if (xml.name() == "enclosure") {
|
||||||
|
@ -240,9 +244,6 @@ RssArticlePtr xmlToRssArticle(RssFeed* parent, QXmlStreamReader& xml)
|
||||||
author = xml.readElementText();
|
author = xml.readElementText();
|
||||||
else if (xml.name() == "guid")
|
else if (xml.name() == "guid")
|
||||||
guid = xml.readElementText();
|
guid = xml.readElementText();
|
||||||
else {
|
|
||||||
qDebug() << "Skipping item tag: " << xml.name();
|
|
||||||
xml.skipCurrentElement();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,10 @@ void RssFeed::parseRSSChannel(QXmlStreamReader& xml)
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
Q_ASSERT(xml.isStartElement() && xml.name() == "channel");
|
Q_ASSERT(xml.isStartElement() && xml.name() == "channel");
|
||||||
|
|
||||||
while (xml.readNextStartElement()) {
|
while(!xml.atEnd()) {
|
||||||
|
xml.readNext();
|
||||||
|
|
||||||
|
if (xml.isStartElement()) {
|
||||||
if (xml.name() == "title") {
|
if (xml.name() == "title") {
|
||||||
m_title = xml.readElementText();
|
m_title = xml.readElementText();
|
||||||
if (m_alias == url())
|
if (m_alias == url())
|
||||||
|
@ -236,9 +239,7 @@ void RssFeed::parseRSSChannel(QXmlStreamReader& xml)
|
||||||
article->markAsRead();
|
article->markAsRead();
|
||||||
m_articles[guid] = article;
|
m_articles[guid] = article;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
qDebug() << "Skipping RSS tag: " << xml.name();
|
|
||||||
xml.skipCurrentElement();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue