mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
[RSS] Handle magnet links as torrents instead of news URLs. Closes #3560
This commit is contained in:
parent
51e0e485f4
commit
c3592304b6
@ -259,8 +259,13 @@ void RssParser::parseRssArticle(QXmlStreamReader& xml, const QString& feedUrl)
|
||||
if (xml.attributes().value("type") == "application/x-bittorrent")
|
||||
article["torrent_url"] = xml.attributes().value("url").toString();
|
||||
}
|
||||
else if (xml.name() == "link")
|
||||
article["news_link"] = xml.readElementText();
|
||||
else if (xml.name() == "link") {
|
||||
QString link = xml.readElementText().trimmed();
|
||||
if (link.startsWith("magnet:", Qt::CaseInsensitive))
|
||||
article["torrent_url"] = link; // magnet link instead of a news URL
|
||||
else
|
||||
article["news_link"] = link;
|
||||
}
|
||||
else if (xml.name() == "description")
|
||||
article["description"] = xml.readElementText();
|
||||
else if (xml.name() == "pubDate")
|
||||
@ -341,17 +346,18 @@ void RssParser::parseAtomArticle(QXmlStreamReader& xml, const QString& feedUrl,
|
||||
article["title"] = doc.toPlainText();
|
||||
}
|
||||
else if (xml.name() == "link") {
|
||||
QString theLink = ( xml.attributes().isEmpty() ?
|
||||
xml.readElementText() :
|
||||
xml.attributes().value("href").toString() );
|
||||
QString link = ( xml.attributes().isEmpty() ?
|
||||
xml.readElementText().trimmed() :
|
||||
xml.attributes().value("href").toString() );
|
||||
|
||||
// Atom feeds can have relative links, work around this and
|
||||
// take the stress of figuring article full URI from UI
|
||||
if (link.startsWith("magnet:", Qt::CaseInsensitive))
|
||||
article["torrent_url"] = link; // magnet link instead of a news URL
|
||||
else
|
||||
// Atom feeds can have relative links, work around this and
|
||||
// take the stress of figuring article full URI from UI
|
||||
// Assemble full URI
|
||||
article["news_link"] = ( baseUrl.isEmpty() ? link : baseUrl + link );
|
||||
|
||||
// Assemble full URI
|
||||
article["news_link"] = ( baseUrl.isEmpty() ?
|
||||
theLink :
|
||||
baseUrl + theLink );
|
||||
}
|
||||
else if (xml.name() == "summary" || xml.name() == "content"){
|
||||
if(double_content) { // Duplicate content -> ignore
|
||||
|
Loading…
Reference in New Issue
Block a user