summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-05-11 14:10:04 +0500
committerPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-05-11 14:10:04 +0500
commit325c7b7b493b4f760acd392f97d2b512e4b3f34e (patch)
treea46cc6ded67d86cee660719cca1c9e5395a44cc2
parent9ec645b5678f7bb15c26c52dd3abf7ed52e96667 (diff)
RSS spec compliance updateHEADmaster
-rwxr-xr-xnewsbin702152 -> 702728 bytes
-rw-r--r--src/RSS.cpp8
-rw-r--r--src/RSS.hpp3
-rw-r--r--src/main.cpp4
4 files changed, 9 insertions, 6 deletions
diff --git a/news b/news
index 85246a8..440e4de 100755
--- a/news
+++ b/news
Binary files differ
diff --git a/src/RSS.cpp b/src/RSS.cpp
index 20c809f..a5c8b12 100644
--- a/src/RSS.cpp
+++ b/src/RSS.cpp
@@ -67,7 +67,9 @@ void RSS::parse(std::string contents) {
// std::cout << "starting tokenization..." << std::endl;
if (contents.length() == 0) return;
try {
- auto leaf = XML_leaf(contents).GetChild("channel");
+ auto leaf = XML_leaf(contents);
+ if (leaf.Name != "channel")
+ leaf = leaf.GetChild("channel");
if (leaf.Raw == "<>")
throw new std::runtime_error("The feed does not contain <channel> element");
@@ -76,8 +78,8 @@ void RSS::parse(std::string contents) {
auto items = leaf.GetChildren("item");
for (auto item : items)
Entries.push_back(RSS_Entry(item));
- } catch (const char *err) {
- std::cout << "Failed to parse feed '" << URL << "' :" << err << std::endl;
+ } catch (std::exception& err) {
+ std::cout << "Failed to parse feed '" << URL << "' :" << err.what() << std::endl;
return;
}
}
diff --git a/src/RSS.hpp b/src/RSS.hpp
index c4a5b2c..8a0292b 100644
--- a/src/RSS.hpp
+++ b/src/RSS.hpp
@@ -106,8 +106,8 @@ class XML_leaf {
static std::string trimSpaces(std::string raw) {
auto outp = std::regex_replace(raw, std::regex("\n"), "");
- outp = std::regex_replace(outp, std::regex("> <"), "><");
outp = std::regex_replace(outp, std::regex(" +"), " ");
+ outp = std::regex_replace(outp, std::regex("> <"), "><");
return outp;
}
@@ -130,6 +130,7 @@ class XML_leaf {
outp.push_back(raw.substr(idx, (next_idx - idx) + 1));
idx = next_idx + 1;
}
+ // std::cout << "Tokenization done" << '\n';
return outp;
};
diff --git a/src/main.cpp b/src/main.cpp
index cabe6dd..737ef8a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -33,8 +33,8 @@ int main() {
// std::cout << "URL: " << src.GetValue() << std::endl;
RSS(src.GetValue()).print_latest(span);
}
- } catch (char *ex) {
- std::cout << "failed to read config file: " << ex << std::endl;
+ } catch (std::exception& err) {
+ std::cout << "failed to read config file: " << err.what() << std::endl;
return 1;
}