Use URL as feeds title/description if it has not title and no description - WTF Vimeo?

This commit is contained in:
Martin Rotter 2020-12-02 11:02:32 +01:00
parent a3e6485739
commit 80eb867949

View File

@ -34,10 +34,25 @@ Message RssParser::extractMessage(const QDomElement& msg_element, QDateTime curr
QString elem_enclosure = msg_element.namedItem(QSL("enclosure")).toElement().attribute(QSL("url"));
QString elem_enclosure_type = msg_element.namedItem(QSL("enclosure")).toElement().attribute(QSL("type"));
new_message.m_url = msg_element.namedItem(QSL("link")).toElement().text();
if (new_message.m_url.isEmpty() && !new_message.m_enclosures.isEmpty()) {
new_message.m_url = new_message.m_enclosures.first().m_url;
}
if (new_message.m_url.isEmpty()) {
// Try to get "href" attribute.
new_message.m_url = msg_element.namedItem(QSL("link")).toElement().attribute(QSL("href"));
}
if (elem_description.isEmpty()) {
elem_description = msg_element.namedItem(QSL("description")).toElement().text();
}
if (elem_description.isEmpty()) {
elem_description = new_message.m_url;
}
// Now we obtained maximum of information for title & description.
if (elem_title.isEmpty()) {
if (elem_description.isEmpty()) {
@ -67,18 +82,6 @@ Message RssParser::extractMessage(const QDomElement& msg_element, QDateTime curr
new_message.m_enclosures.append(mrssGetEnclosures(msg_element));
}
// Deal with link and author.
new_message.m_url = msg_element.namedItem(QSL("link")).toElement().text();
if (new_message.m_url.isEmpty() && !new_message.m_enclosures.isEmpty()) {
new_message.m_url = new_message.m_enclosures.first().m_url;
}
if (new_message.m_url.isEmpty()) {
// Try to get "href" attribute.
new_message.m_url = msg_element.namedItem(QSL("link")).toElement().attribute(QSL("href"));
}
new_message.m_author = msg_element.namedItem(QSL("author")).toElement().text();
if (new_message.m_author.isEmpty()) {