From 52acbd90f6520148b461461fd81a819be31fcee1 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 20 Feb 2018 23:29:55 +0100 Subject: [PATCH] Added special case: ANF News --- CMakeLists.txt | 11 +++++++---- src/parse.cpp | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1543cb3..2d2049d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,10 @@ cmake_minimum_required (VERSION 3.7) include(GNUInstallDirs) +include(FindCURL) +include(FindBoost) project (mastorss - VERSION 0.2.5 + VERSION 0.2.6 LANGUAGES CXX ) @@ -18,9 +20,10 @@ configure_file ( "${PROJECT_BINARY_DIR}/version.hpp" ) -include(FindCURL) find_package(CURL REQUIRED) +find_package(Boost REQUIRED COMPONENTS system filesystem) -add_executable(mastorss src/mastorss.cpp src/http.cpp src/config.cpp src/parse.cpp) -target_link_libraries(mastorss mastodon-cpp boost_system boost_filesystem ssl crypto ${CURL_LIBRARIES} curlpp) +file(GLOB sources src/*.cpp) +add_executable(mastorss ${sources}) +target_link_libraries(mastorss mastodon-cpp ${Boost_LIBRARIES} ssl crypto ${CURL_LIBRARIES} curlpp) install(TARGETS mastorss DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/src/parse.cpp b/src/parse.cpp index 7bac690..bfebdba 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -88,6 +88,12 @@ std::vector parse_website(const string &profile, const string &xml) string desc = v.second.get_child("description").data(); string str = title + "\n\n" + desc; + // ANF News puts this always on top, causing us to think it's new + if (title.compare("Newsticker zu den Angriffen auf Efrîn") == 0) + { + continue; + } + // Some feeds contain encoded xhtml-tags >:| std::regex relt("<"); std::regex regt(">"); @@ -95,6 +101,8 @@ std::vector parse_website(const string &profile, const string &xml) std::regex recdata1(""); std::regex restrip("<[^>]*>"); + + // de.indymedia.org articles sometimes have CSS in the description std::regex reindyfuckup("\\/\\* Style Definitions \\*\\/[.[:space:]]*$"); // Direkte Action closing std::regex redaclosing("Der Beitrag .* erschien zuerst auf Direkte Aktion.");