#include "RSS.hpp" #include #include #include #include #define CONFIG_LOCATION std::getenv("HOME") + "/.config/rsshit.xml" // #define CONFIG_LOCATION "rsshit.xml" std::string read_config() { std::ifstream file(std::string(std::getenv("HOME")) + "/.config/rsshit.xml"); std::stringstream buffer; buffer << file.rdbuf(); return buffer.str(); } int main() { std::string config; try { config = read_config(); if (config.length() == 0) { std::cout << "failed to read config file: the file is empty" << std::endl; return 1; } XML_leaf configParsed(config); auto sources = configParsed.GetChildren("source"); for (auto src : sources) { std::cout << "URL: " << src.GetValue() << std::endl; RSS(src.GetValue()).print(); } } catch (char *ex) { std::cout << "failed to read config file: " << ex << std::endl; return 1; } // RSS("https://www.independent.co.uk/news/uk/rss").print(); // RSS("https://news.yahoo.com/rss/mostviewed").print(); return 0; }