| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard-standard/src/parsers/rdfparser.cpp`/ |
| 2 | |
| 3 | #include "src/parsers/rdfparser.h"cxx . . $ `<file>/src/librssguard-standard/src/parsers/rdfparser.h`/ |
| 4 | |
| 5 | #include "src/definitions.h"cxx . . $ `<file>/src/librssguard-standard/src/definitions.h`/ |
| 6 | #include "src/standardfeed.h"cxx . . $ `<file>/src/librssguard-standard/src/standardfeed.h`/ |
| 7 | |
| 8 | #include <librssguard/exceptions/applicationexception.h>cxx . . $ `<file>/src/librssguard/exceptions/applicationexception.h`/ |
| 9 | #include <librssguard/miscellaneous/settings.h>cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/ |
| 10 | #include <librssguard/miscellaneous/textfactory.h>cxx . . $ `<file>/src/librssguard/miscellaneous/textfactory.h`/ |
| 11 | |
| 12 | #include <QDomDocument> |
| 13 | #include <QTextCodec> |
| 14 | |
| 15 | RdfParsercxx . . $ RdfParser#::RdfParsercxx . . $ RdfParser#RdfParser(3520e46b33348bf6).(const QStringcxx . . $ QString#& data) |
| 16 | : FeedParsercxx . . $ FeedParser#(datacxx . . $ QString#QString(132dd6869045752b).), m_rdfNamespacecxx . . $ RdfParser#m_rdfNamespace.(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("http://www.w3.org/1999/02/22-rdf-syntax-ns#")), |
| 17 | m_rssNamespacecxx . . $ RdfParser#m_rssNamespace.(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("http://purl.org/rss/1.0/")), m_rssCoNamespacecxx . . $ RdfParser#m_rssCoNamespace.(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("http://purl.org/rss/1.0/modules/content/")), |
| 18 | m_dcElNamespacecxx . . $ RdfParser#m_dcElNamespace.(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("http://purl.org/dc/elements/1.1/")) {} |
| 19 | |
| 20 | RdfParsercxx . . $ RdfParser#::~cxx . . $ RdfParser#`~RdfParser`(ced63f7c635d850d).RdfParsercxx . . $ RdfParser#() {} |
| 21 | |
| 22 | QListcxx . . $ QList#<StandardFeedcxx . . $ StandardFeed#*> RdfParsercxx . . $ RdfParser#::discoverFeedscxx . . $ RdfParser#discoverFeeds(655c2d6665325f1d).(ServiceRootcxx . . $ ServiceRoot#* root, const QUrlcxx . . $ QUrl#& url, bool greedy) const { |
| 23 | auto base_result = FeedParsercxx . . $ FeedParser#::discoverFeedscxx . . $ FeedParser#discoverFeeds(655c2d6665325f1d).(root, url, greedy); |
| 24 | |
| 25 | if (!base_result.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 26 | return base_result; |
| 27 | } |
| 28 | |
| 29 | QStringcxx . . $ QString# my_url = url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).(); |
| 30 | QListcxx . . $ QList#<StandardFeedcxx . . $ StandardFeed#*> feedscxx . . $ QList#QList(ced63f7c635d850d).; |
| 31 | |
| 32 | // 1. Test direct URL for a feed. |
| 33 | // 2. Test embedded RDF feed links from HTML data. |
| 34 | // 3. Test "URL/feed" endpoint. |
| 35 | // 4. Test "URL/rdf" endpoint. |
| 36 | |
| 37 | // Download URL. |
| 38 | int timeout = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Feeds), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Feeds::UpdateTimeout)).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 39 | QByteArraycxx . . $ QByteArray# datacxx . . $ QByteArray#QByteArray(ced63f7c635d850d).; |
| 40 | auto res = NetworkFactorycxx . . $ NetworkFactory#::performNetworkOperationcxx . . $ NetworkFactory#performNetworkOperation(98c2fa0f32201561).(my_url, |
| 41 | timeout, |
| 42 | {cxx . . $ QByteArray#QByteArray(ced63f7c635d850d).}, |
| 43 | data, |
| 44 | QNetworkAccessManagercxx . . $ QNetworkAccessManager#::Operationcxx . . $ QNetworkAccessManager#Operation#::GetOperationcxx . . $ QNetworkAccessManager#GetOperation., |
| 45 | {cxx . . $ QList#QList(ced63f7c635d850d).}, |
| 46 | {}, |
| 47 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 48 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 49 | root->networkProxycxx . . $ ServiceRoot#networkProxy(e4d242e7a984a99c).()); |
| 50 | |
| 51 | if (res.m_networkErrorcxx . . $ NetworkResult#m_networkError. == QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 52 | try { |
| 53 | // 1. |
| 54 | auto guessed_feed = guessFeedcxx . . $ RdfParser#guessFeed(8d4767951e91e29f).(data, res); |
| 55 | |
| 56 | return {cxx . . $ QList#QList(b6da5b9a9f304025).guessed_feed.firstcxx . . $ std/pair#first.}; |
| 57 | } |
| 58 | catch (...) { |
| 59 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_STANDARDcxx . . $ `src/librssguard-standard/src/definitions.h:8:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(my_url) <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "is not a direct feed file."; |
| 60 | } |
| 61 | |
| 62 | // 2. |
| 63 | static QRegularExpressioncxx . . $ QRegularExpression# rxcxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(RSS_REGEX_MATCHERcxx . . $ `src/librssguard-standard/src/definitions.h:12:9`!), QRegularExpressioncxx . . $ QFlags#QFlags(93d577a3e9528307).::PatternOptioncxx . . $ QRegularExpression#PatternOption#::CaseInsensitiveOptioncxx . . $ QRegularExpression#CaseInsensitiveOption.); |
| 64 | static QRegularExpressioncxx . . $ QRegularExpression# rx_hrefcxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(RSS_HREF_REGEX_MATCHERcxx . . $ `src/librssguard-standard/src/definitions.h:13:9`!), |
| 65 | QRegularExpressioncxx . . $ QFlags#QFlags(93d577a3e9528307).::PatternOptioncxx . . $ QRegularExpression#PatternOption#::CaseInsensitiveOptioncxx . . $ QRegularExpression#CaseInsensitiveOption.); |
| 66 | |
| 67 | rx_href.optimizecxx . . $ QRegularExpression#optimize(83f5f38750778ac8).(); |
| 68 | |
| 69 | QRegularExpressionMatchIteratorcxx . . $ QRegularExpressionMatchIterator# it_rx = rx.globalMatchcxx . . $ QRegularExpression#globalMatch(27b5aa3d61ae1b2f).(QStringcxx . . $ QString#::fromUtf8cxx . . $ QString#fromUtf8(4e15edac36d215be).(data)); |
| 70 | |
| 71 | while (it_rx.hasNextcxx . . $ QRegularExpressionMatchIterator#hasNext(50ce9a9e25b4a850).()) { |
| 72 | QRegularExpressionMatchcxx . . $ QRegularExpressionMatch# mat_tx = it_rx.nextcxx . . $ QRegularExpressionMatchIterator#next(5870644aafa115db).(); |
| 73 | QStringcxx . . $ QString# link_tag = mat_tx.capturedcxx . . $ QRegularExpressionMatch#captured(3f3c3d0e9c0eb37f).(); |
| 74 | QStringcxx . . $ QString# feed_link = rx_href.matchcxx . . $ QRegularExpression#match(d076266091fa4922).(link_tag).capturedcxx . . $ QRegularExpressionMatch#captured(3f3c3d0e9c0eb37f).(1); |
| 75 | |
| 76 | if (feed_link.startsWithcxx . . $ QString#startsWith(9b0c247ef39438e0).(QL1Scxx . . $ `src/librssguard/definitions/definitions.h:449:9`!("//"))) { |
| 77 | feed_link =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(URI_SCHEME_HTTPcxx . . $ `src/librssguard/definitions/definitions.h:35:9`!) + feed_link.midcxx . . $ QString#mid(5eea715ff28b9227).(2); |
| 78 | } |
| 79 | else if (feed_link.startsWithcxx . . $ QString#startsWith(7cf081d1b6a1defd).(QL1Ccxx . . $ `src/librssguard/definitions/definitions.h:455:9`!('/'))) { |
| 80 | feed_link =cxx . . $ QString#`operator=`(4f35bf974e7f8568). url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).(QUrlcxx . . $ QUrl#::UrlFormattingOptioncxx . . $ QUrl#UrlFormattingOption#::RemovePathcxx . . $ QUrl#RemovePath. |cxx . . $ `operator|`(62016c0c8fcc1dd7). QUrlcxx . . $ QUrl#::UrlFormattingOptioncxx . . $ QUrl#UrlFormattingOption#::RemoveQuerycxx . . $ QUrl#RemoveQuery. |cxx . . $ QUrlTwoFlags#`operator|`(93b783eb06d1455a). |
| 81 | QUrlcxx . . $ QUrl#::UrlFormattingOptioncxx . . $ QUrl#UrlFormattingOption#::StripTrailingSlashcxx . . $ QUrl#StripTrailingSlash.) + |
| 82 | feed_link; |
| 83 | } |
| 84 | |
| 85 | QByteArraycxx . . $ QByteArray# datacxx . . $ QByteArray#QByteArray(ced63f7c635d850d).; |
| 86 | auto res = NetworkFactorycxx . . $ NetworkFactory#::performNetworkOperationcxx . . $ NetworkFactory#performNetworkOperation(98c2fa0f32201561).(feed_link, |
| 87 | timeout, |
| 88 | {cxx . . $ QByteArray#QByteArray(ced63f7c635d850d).}, |
| 89 | data, |
| 90 | QNetworkAccessManagercxx . . $ QNetworkAccessManager#::Operationcxx . . $ QNetworkAccessManager#Operation#::GetOperationcxx . . $ QNetworkAccessManager#GetOperation., |
| 91 | {cxx . . $ QList#QList(ced63f7c635d850d).}, |
| 92 | {}, |
| 93 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 94 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 95 | root->networkProxycxx . . $ ServiceRoot#networkProxy(e4d242e7a984a99c).()); |
| 96 | |
| 97 | if (res.m_networkErrorcxx . . $ NetworkResult#m_networkError. == QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 98 | try { |
| 99 | auto guessed_feed = guessFeedcxx . . $ RdfParser#guessFeed(8d4767951e91e29f).(data, res); |
| 100 | |
| 101 | feeds.appendcxx . . $ QList#append(200d2dc08238a4ed).(guessed_feed.firstcxx . . $ std/pair#first.); |
| 102 | } |
| 103 | catch (const ApplicationExceptioncxx . . $ ApplicationException#& ex) { |
| 104 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_STANDARDcxx . . $ `src/librssguard-standard/src/definitions.h:8:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(feed_link) |
| 105 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " should be direct link to feed file but was not recognized:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(ex.message()); |
| 106 | } |
| 107 | } |
| 108 | else { |
| 109 | logUnsuccessfulRequestcxx . . $ FeedParser#logUnsuccessfulRequest(47b1d5c220470698).(res); |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | else { |
| 114 | logUnsuccessfulRequestcxx . . $ FeedParser#logUnsuccessfulRequest(47b1d5c220470698).(res); |
| 115 | } |
| 116 | |
| 117 | // 3. |
| 118 | my_url =cxx . . $ QString#`operator=`(4f35bf974e7f8568). url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).(QUrlcxx . . $ QUrlTwoFlags#QUrlTwoFlags(9b289cee16747614).::UrlFormattingOptioncxx . . $ QUrl#UrlFormattingOption#::StripTrailingSlashcxx . . $ QUrl#StripTrailingSlash.) + QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("/feed"); |
| 119 | res =cxx . . $ NetworkResult#`operator=`(d5cbbc99e5782161). NetworkFactorycxx . . $ NetworkFactory#::performNetworkOperationcxx . . $ NetworkFactory#performNetworkOperation(98c2fa0f32201561).(my_url, |
| 120 | timeout, |
| 121 | {cxx . . $ QByteArray#QByteArray(ced63f7c635d850d).}, |
| 122 | data, |
| 123 | QNetworkAccessManagercxx . . $ QNetworkAccessManager#::Operationcxx . . $ QNetworkAccessManager#Operation#::GetOperationcxx . . $ QNetworkAccessManager#GetOperation., |
| 124 | {cxx . . $ QList#QList(ced63f7c635d850d).}, |
| 125 | {}, |
| 126 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 127 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 128 | root->networkProxycxx . . $ ServiceRoot#networkProxy(e4d242e7a984a99c).()); |
| 129 | |
| 130 | if (res.m_networkErrorcxx . . $ NetworkResult#m_networkError. == QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 131 | try { |
| 132 | auto guessed_feed = guessFeedcxx . . $ RdfParser#guessFeed(8d4767951e91e29f).(data, res); |
| 133 | |
| 134 | feeds.appendcxx . . $ QList#append(200d2dc08238a4ed).(guessed_feed.firstcxx . . $ std/pair#first.); |
| 135 | } |
| 136 | catch (...) { |
| 137 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_STANDARDcxx . . $ `src/librssguard-standard/src/definitions.h:8:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(my_url) <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "is not a direct feed file."; |
| 138 | } |
| 139 | } |
| 140 | else { |
| 141 | logUnsuccessfulRequestcxx . . $ FeedParser#logUnsuccessfulRequest(47b1d5c220470698).(res); |
| 142 | } |
| 143 | |
| 144 | // 4. |
| 145 | my_url =cxx . . $ QString#`operator=`(4f35bf974e7f8568). url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).(QUrlcxx . . $ QUrlTwoFlags#QUrlTwoFlags(9b289cee16747614).::UrlFormattingOptioncxx . . $ QUrl#UrlFormattingOption#::StripTrailingSlashcxx . . $ QUrl#StripTrailingSlash.) + QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("/rdf"); |
| 146 | res =cxx . . $ NetworkResult#`operator=`(d5cbbc99e5782161). NetworkFactorycxx . . $ NetworkFactory#::performNetworkOperationcxx . . $ NetworkFactory#performNetworkOperation(98c2fa0f32201561).(my_url, |
| 147 | timeout, |
| 148 | {cxx . . $ QByteArray#QByteArray(ced63f7c635d850d).}, |
| 149 | data, |
| 150 | QNetworkAccessManagercxx . . $ QNetworkAccessManager#::Operationcxx . . $ QNetworkAccessManager#Operation#::GetOperationcxx . . $ QNetworkAccessManager#GetOperation., |
| 151 | {cxx . . $ QList#QList(ced63f7c635d850d).}, |
| 152 | {}, |
| 153 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 154 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 155 | root->networkProxycxx . . $ ServiceRoot#networkProxy(e4d242e7a984a99c).()); |
| 156 | |
| 157 | if (res.m_networkErrorcxx . . $ NetworkResult#m_networkError. == QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 158 | try { |
| 159 | auto guessed_feed = guessFeedcxx . . $ RdfParser#guessFeed(8d4767951e91e29f).(data, res); |
| 160 | |
| 161 | feeds.appendcxx . . $ QList#append(200d2dc08238a4ed).(guessed_feed.firstcxx . . $ std/pair#first.); |
| 162 | } |
| 163 | catch (...) { |
| 164 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_STANDARDcxx . . $ `src/librssguard-standard/src/definitions.h:8:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(my_url) <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "is not a direct feed file."; |
| 165 | } |
| 166 | } |
| 167 | else { |
| 168 | logUnsuccessfulRequestcxx . . $ FeedParser#logUnsuccessfulRequest(47b1d5c220470698).(res); |
| 169 | } |
| 170 | |
| 171 | return feeds; |
| 172 | } |
| 173 | |
| 174 | QPaircxx . . $ QPair#<StandardFeedcxx . . $ StandardFeed#*, QListcxx . . $ QList#<IconLocationcxx . . $ IconLocation#>> RdfParsercxx . . $ RdfParser#::guessFeedcxx . . $ RdfParser#guessFeed(8d4767951e91e29f).(const QByteArraycxx . . $ QByteArray#& content, |
| 175 | const NetworkResultcxx . . $ NetworkResult#& network_res) const { |
| 176 | QStringcxx . . $ QString# xml_schema_encoding = QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(DEFAULT_FEED_ENCODINGcxx . . $ `src/librssguard-standard/src/definitions.h:4:9`!); |
| 177 | QStringcxx . . $ QString# xml_contents_encodedcxx . . $ QString#QString(ced63f7c635d850d).; |
| 178 | QStringcxx . . $ QString# enc = |
| 179 | QRegularExpressioncxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("encoding=\"([A-Z0-9\\-]+)\""), QRegularExpressioncxx . . $ QFlags#QFlags(93d577a3e9528307).::PatternOptioncxx . . $ QRegularExpression#PatternOption#::CaseInsensitiveOptioncxx . . $ QRegularExpression#CaseInsensitiveOption.) |
| 180 | .matchcxx . . $ QRegularExpression#match(d076266091fa4922).(contentcxx . . $ QString#QString(45672f3c6961a244).) |
| 181 | .capturedcxx . . $ QRegularExpressionMatch#captured(3f3c3d0e9c0eb37f).(1); |
| 182 | |
| 183 | if (!enc.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 184 | // Some "encoding" attribute was found get the encoding |
| 185 | // out of it. |
| 186 | xml_schema_encoding =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). enc; |
| 187 | } |
| 188 | |
| 189 | QTextCodeccxx . . $ QTextCodec#* custom_codec = QTextCodeccxx . . $ QTextCodec#::codecForNamecxx . . $ QTextCodec#codecForName(9094647911411626).(xml_schema_encoding.toLocal8Bitcxx . . $ QString#toLocal8Bit(ef52b713090bc85a).()); |
| 190 | |
| 191 | if (custom_codec != nullptr) { |
| 192 | xml_contents_encoded =cxx . . $ QString#`operator=`(4f35bf974e7f8568). custom_codec->toUnicodecxx . . $ QTextCodec#toUnicode(5b58488ffc88f4c0).(content); |
| 193 | } |
| 194 | else { |
| 195 | xml_contents_encoded =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::fromUtf8cxx . . $ QString#fromUtf8(4e15edac36d215be).(content); |
| 196 | } |
| 197 | |
| 198 | // NOTE: Some XMLs have whitespace before XML declaration, erase it. |
| 199 | xml_contents_encoded =cxx . . $ QString#`operator=`(4f35bf974e7f8568). xml_contents_encoded.trimmedcxx . . $ QString#trimmed(dca2c5857e9adf82).(); |
| 200 | |
| 201 | // Feed XML was obtained, guess it now. |
| 202 | QDomDocumentcxx . . $ QDomDocument# xml_documentcxx . . $ QDomDocument#QDomDocument(49f6e7a06ebc5aa8).; |
| 203 | QStringcxx . . $ QString# error_msgcxx . . $ QString#QString(ced63f7c635d850d).; |
| 204 | int error_line, error_column; |
| 205 | |
| 206 | if (!xml_document.setContentcxx . . $ QDomDocument#setContent(c1966f5c3af9dbd8).(xml_contents_encoded, true, &error_msg, &error_line, &error_column)) { |
| 207 | throw ApplicationExceptioncxx . . $ ApplicationException#(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("XML is not well-formed, %1").argcxx . . $ QString#arg(ad0bca07273edcc2).(error_msg)); |
| 208 | } |
| 209 | |
| 210 | QDomElementcxx . . $ QDomElement# root_element = xml_document.documentElementcxx . . $ QDomDocument#documentElement(654df8c29726cab1).(); |
| 211 | |
| 212 | if (root_element.namespaceURIcxx . . $ QDomNode#namespaceURI(6ef7b6c27b00b43d).() !=cxx . . $ `operator!=`(5bc2975d2d751687). rdfNamespacecxx . . $ RdfParser#rdfNamespace(6ef7b6c27b00b43d).()) { |
| 213 | throw ApplicationExceptioncxx . . $ ApplicationException#(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("not an RDF feed")); |
| 214 | } |
| 215 | |
| 216 | auto* feed = new StandardFeedcxx . . $ StandardFeed#(); |
| 217 | QListcxx . . $ QList#<IconLocationcxx . . $ IconLocation#> icon_possible_locationscxx . . $ QList#QList(ced63f7c635d850d).; |
| 218 | |
| 219 | feed->setEncodingcxx . . $ StandardFeed#setEncoding(3520e46b33348bf6).(xml_schema_encoding); |
| 220 | feed->setTypecxx . . $ StandardFeed#setType(225efdd3340de66f).(StandardFeedcxx . . $ StandardFeed#::Typecxx . . $ StandardFeed#Type#::Rdfcxx . . $ StandardFeed#Type#Rdf.); |
| 221 | feed->setSourcecxx . . $ Feed#setSource(3520e46b33348bf6).(network_res.m_urlcxx . . $ NetworkResult#m_url..toStringcxx . . $ QUrl#toString(632475ebea3355f1).()); |
| 222 | |
| 223 | QDomElementcxx . . $ QDomElement# channel_element = root_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(rssNamespacecxx . . $ RdfParser#rssNamespace(6ef7b6c27b00b43d).(), QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("channel")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).(); |
| 224 | |
| 225 | feed->setTitlecxx . . $ RootItem#setTitle(3520e46b33348bf6).(channel_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(rssNamespacecxx . . $ RdfParser#rssNamespace(6ef7b6c27b00b43d).(), QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("title")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).().textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).()); |
| 226 | feed |
| 227 | ->setDescriptioncxx . . $ RootItem#setDescription(3520e46b33348bf6).(channel_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(rssNamespacecxx . . $ RdfParser#rssNamespace(6ef7b6c27b00b43d).(), QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("description")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).().textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).()); |
| 228 | |
| 229 | QStringcxx . . $ QString# home_page = channel_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(rssNamespacecxx . . $ RdfParser#rssNamespace(6ef7b6c27b00b43d).(), QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("link")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).().textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).(); |
| 230 | |
| 231 | if (!home_page.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 232 | icon_possible_locations.prependcxx . . $ QList#prepend(1262c8661f7a27a7).({cxx . . $ IconLocation#IconLocation(37c160c81b6367f7).home_page, false}); |
| 233 | } |
| 234 | |
| 235 | return {cxx . . $ std/pair#pair(14d64bafa7379ebc).feed, icon_possible_locations}; |
| 236 | } |
| 237 | |
| 238 | QDomNodeListcxx . . $ QDomNodeList# RdfParsercxx . . $ RdfParser#::xmlMessageElementscxx . . $ RdfParser#xmlMessageElements(8f5c35a0089aa953).() { |
| 239 | return m_xmlcxx . . $ FeedParser#m_xml..elementsByTagNameNScxx . . $ QDomDocument#elementsByTagNameNS(45109530c3f6945e).(m_rssNamespacecxx . . $ RdfParser#m_rssNamespace., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("item")); |
| 240 | } |
| 241 | |
| 242 | QStringcxx . . $ QString# RdfParsercxx . . $ RdfParser#::rssNamespacecxx . . $ RdfParser#rssNamespace(6ef7b6c27b00b43d).() const { |
| 243 | return m_rssNamespacecxx . . $ QString#QString(132dd6869045752b).; |
| 244 | } |
| 245 | |
| 246 | QStringcxx . . $ QString# RdfParsercxx . . $ RdfParser#::rdfNamespacecxx . . $ RdfParser#rdfNamespace(6ef7b6c27b00b43d).() const { |
| 247 | return m_rdfNamespacecxx . . $ QString#QString(132dd6869045752b).; |
| 248 | } |
| 249 | |
| 250 | QStringcxx . . $ QString# RdfParsercxx . . $ RdfParser#::xmlMessageTitlecxx . . $ RdfParser#xmlMessageTitle(57196eada37bf09).(const QDomElementcxx . . $ QDomElement#& msg_element) const { |
| 251 | return msg_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(m_rssNamespacecxx . . $ RdfParser#m_rssNamespace., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("title")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).().textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).(); |
| 252 | } |
| 253 | |
| 254 | QStringcxx . . $ QString# RdfParsercxx . . $ RdfParser#::xmlMessageDescriptioncxx . . $ RdfParser#xmlMessageDescription(57196eada37bf09).(const QDomElementcxx . . $ QDomElement#& msg_element) const { |
| 255 | QStringcxx . . $ QString# description = msg_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(m_rssCoNamespacecxx . . $ RdfParser#m_rssCoNamespace., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("encoded")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).().textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).(); |
| 256 | |
| 257 | if (description.simplifiedcxx . . $ QString#simplified(dca2c5857e9adf82).().isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 258 | description =cxx . . $ QString#`operator=`(4f35bf974e7f8568). msg_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(m_rssNamespacecxx . . $ RdfParser#m_rssNamespace., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("description")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).().textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).(); |
| 259 | } |
| 260 | |
| 261 | return descriptioncxx . . $ QString#QString(28715ad661ad3cec).; |
| 262 | } |
| 263 | |
| 264 | QStringcxx . . $ QString# RdfParsercxx . . $ RdfParser#::xmlMessageAuthorcxx . . $ RdfParser#xmlMessageAuthor(57196eada37bf09).(const QDomElementcxx . . $ QDomElement#& msg_element) const { |
| 265 | return msg_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(m_dcElNamespacecxx . . $ RdfParser#m_dcElNamespace., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("creator")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).().textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).(); |
| 266 | } |
| 267 | |
| 268 | QDateTimecxx . . $ QDateTime# RdfParsercxx . . $ RdfParser#::xmlMessageDateCreatedcxx . . $ RdfParser#xmlMessageDateCreated(2ace5341a9cbf11d).(const QDomElementcxx . . $ QDomElement#& msg_element) { |
| 269 | return TextFactorycxx . . $ TextFactory#::parseDateTimecxx . . $ TextFactory#parseDateTime(a28da78309843c43).(msg_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(m_dcElNamespacecxx . . $ RdfParser#m_dcElNamespace., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("date")) |
| 270 | .atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0) |
| 271 | .toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).() |
| 272 | .textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).(), |
| 273 | &m_dateTimeFormatcxx . . $ FeedParser#m_dateTimeFormat.); |
| 274 | } |
| 275 | |
| 276 | QStringcxx . . $ QString# RdfParsercxx . . $ RdfParser#::xmlMessageIdcxx . . $ RdfParser#xmlMessageId(57196eada37bf09).(const QDomElementcxx . . $ QDomElement#& msg_element) const { |
| 277 | return msg_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(m_dcElNamespacecxx . . $ RdfParser#m_dcElNamespace., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("identifier")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).().textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).(); |
| 278 | } |
| 279 | |
| 280 | QStringcxx . . $ QString# RdfParsercxx . . $ RdfParser#::xmlMessageUrlcxx . . $ RdfParser#xmlMessageUrl(57196eada37bf09).(const QDomElementcxx . . $ QDomElement#& msg_element) const { |
| 281 | return msg_element.elementsByTagNameNScxx . . $ QDomElement#elementsByTagNameNS(1629acf873ced174).(m_rssNamespacecxx . . $ RdfParser#m_rssNamespace., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("link")).atcxx . . $ QDomNodeList#at(b6c6c70d5ef857b9).(0).toElementcxx . . $ QDomNode#toElement(654df8c29726cab1).().textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).(); |
| 282 | } |
| 283 | |
| 284 | QListcxx . . $ QList#<Enclosurecxx . . $ Enclosure#> RdfParsercxx . . $ RdfParser#::xmlMessageEnclosurescxx . . $ RdfParser#xmlMessageEnclosures(c082a2068503f7b9).(const QDomElementcxx . . $ QDomElement#& msg_element) const { |
| 285 | return {cxx . . $ QList#QList(ced63f7c635d850d).}; |
| 286 | } |