diff --git a/src/pageManager.cpp b/src/pageManager.cpp index 5b218df..d5d9ebd 100644 --- a/src/pageManager.cpp +++ b/src/pageManager.cpp @@ -226,12 +226,11 @@ Reply PageManager::getServerRequest(std::string protocol, std::string Url, bool } else returnUrl=url; - /* always cleanup */ /* Mach den Griff zu, schreib die Kekse! */ curl_easy_cleanup(curl); - if(returnUrl.find("/_ray/pow") != std::string::npos) { + if(returnUrl.find("/_ray/pow") != std::string::npos || readBuffer.find("403 Forbidden") != std::string::npos ) { std::cout << " \33[2K\r => CLOUD FLARE PROTECTION (Try " << rek_num << "/15)..." << std::flush; usleep(400000); @@ -521,7 +520,7 @@ checkNameRply PageManager::checkName(std::vector &pages, std::string Name, if(useFirstPage) { if(debugMode) - std::cerr << "Nimm gleiche diese Seite, da useFirstPage auf true ist: " << pages.at(i).url << std::endl; + std::cout << "Nimm gleiche diese Seite, da useFirstPage auf true ist: " << pages.at(i).url << std::endl; break; // nimm gleich das erste } } @@ -574,7 +573,7 @@ std::string PageManager::getLinks(std::string HTML) std::cerr << " => WARNUNG KONNTE Punkt' " << e << "' nicht nach den Links finden; nächster Versuch..." << std::endl; } else { if(debugMode && b > 1) - std::cerr << " => INFO: Punkt' " << e << "' gefunden an: " << pos << std::endl; + std::cout << " => INFO: Punkt' " << e << "' gefunden an: " << pos << std::endl; break; } } diff --git a/src/parameterManager.cpp b/src/parameterManager.cpp index 27f7778..3254a28 100644 --- a/src/parameterManager.cpp +++ b/src/parameterManager.cpp @@ -1100,13 +1100,13 @@ int unterOption_info(Settings *settings, int argc, char **argv) {"socks5-proxy", required_argument, nullptr, 'p'}, {"output-file", required_argument, nullptr, 'o'}, {"internet-pages", required_argument, nullptr, 'i'}, - {"lade-bild-herunter", required_argument, nullptr, 'i'}, + {"lade-bild-herunter", required_argument, nullptr, 'l'}, {"use-first-page", no_argument, nullptr, 'f'}, {"help", no_argument, nullptr, 'h'}, {"colorless", no_argument, nullptr, 'c'}, {"debug-mode", no_argument, nullptr, 'd'}, - {"skip-episoden-names", no_argument, nullptr, 'l'}, + {"skip-episoden-names", no_argument, nullptr, 's'}, {"no-log", no_argument, nullptr, 'n'}, {nullptr, no_argument, nullptr, 0} diff --git a/src/parameterManager.h b/src/parameterManager.h index 7d0e3c4..b4927bd 100644 --- a/src/parameterManager.h +++ b/src/parameterManager.h @@ -24,7 +24,7 @@ #define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files=" #define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files=" -#define VERSION "6.3.0" +#define VERSION "6.3.1" #define DEFAULT_FILE_VERSION "2.5" diff --git a/src/programManager.cpp b/src/programManager.cpp index 5ae9b44..7893611 100644 --- a/src/programManager.cpp +++ b/src/programManager.cpp @@ -213,12 +213,12 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana //Führe unterfunction zum suchen von Serien aus, aber ohne suche auszugeben und speichere datein in variable if(searchModus(settings, &finds, true) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Function searchModus returned error." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Function searchModus returned error." << std::endl; return 24; } else if( finds == "" ) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": ERROR:?? searchModus's returnValue = '' => Nothing found!" << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": ERROR:?? searchModus's returnValue = '' => Nothing found!" << std::endl; return NO_ERROR_BUT_EXIT_RETURN; @@ -226,7 +226,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana // Wenn der Rückgabe wert ungültig ist brich ab... else if( finds.find("|/") == std::string::npos ) { // || if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": searchModus's returnValue contains no / or | => error " << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": searchModus's returnValue contains no / or | => error " << std::endl; return 121; // error -10101 (NO_ERROR_BUT_EXIT_RETURN); @@ -296,7 +296,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Return value from searchModus.subStr(pos(/)-> next |, after /) is ''." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Return value from searchModus.subStr(pos(/)-> next |, after /) is ''." << std::endl; return 48; } hasNewName = true; @@ -327,7 +327,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana if ( line != "") { std::cout << " => Abbruch..." << std::endl; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": User tipped an Value => wrong serie." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": User tipped an Value => wrong serie." << std::endl; return NO_ERROR_BUT_EXIT_RETURN; } @@ -335,7 +335,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana if ( (finds = finds.substr( finds.find("|/") + 2, finds.find("|", finds.find("|/") + 2) - finds.find("|/") -2) ) == "" ) { std::cout << " => Error: Konnte den Namen aus der zurückgegebenen Zeile nicht extrahieren." << std::endl; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Return value from searchModus.subStr(pos(/)-> next |, after /) is ''." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Return value from searchModus.subStr(pos(/)-> next |, after /) is ''." << std::endl; return 46; } @@ -352,7 +352,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana if( !found ) { std::cout << " => Error: Konnte '" << gewollteSeitenUrl << "' nicht als Valide Seite erkennen!" << std::endl; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ":failed to search url in pagesList from setings object" << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ":failed to search url in pagesList from setings object" << std::endl; return 45; } @@ -370,12 +370,12 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana else if( ret.status == ret.NOTHING_FOUND ) { std::cout << " => Error: Konnte die von der Suche vorgeschlagene Serie nicht finden." << std::endl; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Extracted Name from searchModus is invalid." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Extracted Name from searchModus is invalid." << std::endl; return 47; } else if( ret.status == ret.NO_WORKING_PAGE ) { std::cout << " => Error: Keine Funktionierende Internetseite!" << std::endl; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Keine Funktionierende Internetseite!" << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Keine Funktionierende Internetseite!" << std::endl; return 0; } else { @@ -384,7 +384,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana newNameAndPage.correct_name = ret.correct_name; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Use new SerienName: '" << ret.correct_name << "' (" << ret.url_name << ")." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Use new SerienName: '" << ret.correct_name << "' (" << ret.url_name << ")." << std::endl; return 0; } } @@ -395,7 +395,7 @@ int ProgramManager::checkLastProgrammUpdate(Settings *settings) //Wenn die Funktion deaktiviert ist brich ab, wenn nicht nur diffdays verlangt wird if(settings->programmUpdateWarningDays == 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": In settings: Programm --- upDateWaring is deaktivated(seted to 0)." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": In settings: Programm --- upDateWaring is deaktivated(seted to 0)." << std::endl; return 0; } @@ -405,18 +405,18 @@ int ProgramManager::checkLastProgrammUpdate(Settings *settings) if(!ofs2.is_open()) { perror(("Konnte die Datei '" + settings->lastProgrammUpdateDateFilePath + "' nicht öffnen").c_str()); if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Failed to create Last Programm Update Date File:'" << settings->lastProgrammUpdateDateFilePath << "'." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Failed to create Last Programm Update Date File:'" << settings->lastProgrammUpdateDateFilePath << "'." << std::endl; return 1; } else { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Ordfolgreich Last Programm UpdateTime Save File erstellt:'" << settings->lastProgrammUpdateDateFilePath << "'." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Ordfolgreich Last Programm UpdateTime Save File erstellt:'" << settings->lastProgrammUpdateDateFilePath << "'." << std::endl; ofs2 << "0" << std::endl; ofs2.close(); ifs.open(settings->lastProgrammUpdateDateFilePath); if(!ifs.is_open()) { perror(("Konnte die Datei '" + settings->lastProgrammUpdateDateFilePath + "' nicht öffnen").c_str()); if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Failed to open Last Programm Update Date File:'" << settings->lastProgrammUpdateDateFilePath << "'." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Failed to open Last Programm Update Date File:'" << settings->lastProgrammUpdateDateFilePath << "'." << std::endl; return 4545; } } @@ -426,7 +426,7 @@ int ProgramManager::checkLastProgrammUpdate(Settings *settings) if(!std::getline(ifs, line).good()) { perror("GetLine from Date failed"); if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Get the first Line of the Last Programm UpdateDate File failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Get the first Line of the Last Programm UpdateDate File failed." << std::endl; return 2; } else if( ( ( difDays = static_cast(pageManager.getDate()) - atoll(line.c_str()) )) >= settings->programmUpdateWarningDays) { @@ -464,7 +464,7 @@ int ProgramManager::checkLastProgrammUpdate(Settings *settings) std::cout << "Letzte Update Suche vor " << difDays << " tagen!" << std::endl; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Exit with success." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Exit with success." << std::endl; return 0; } @@ -474,7 +474,7 @@ int ProgramManager::checkLastUpdate(Settings *settings, ssize_t *days = nullptr) //Wenn die Funktion deaktiviert ist brich ab, wenn nicht nur diffdays verlangt wird if(settings->updateWarningDays == 0 && !days) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": In settings: upDateWaring is deaktivated(seted to 0)." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": In settings: upDateWaring is deaktivated(seted to 0)." << std::endl; return 0; } @@ -484,18 +484,18 @@ int ProgramManager::checkLastUpdate(Settings *settings, ssize_t *days = nullptr) if(!ofs2.is_open()) { perror(("Konnte die Datei '" + settings->lastUpdateDateFilePath + "' nicht öffnen").c_str()); if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Failed to create Last Update Date File:'" << settings->lastUpdateDateFilePath << "'." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Failed to create Last Update Date File:'" << settings->lastUpdateDateFilePath << "'." << std::endl; return 1; } else { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Ordfolgreich LastUpdateTime Save File erstellt:'" << settings->lastUpdateDateFilePath << "'." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Ordfolgreich LastUpdateTime Save File erstellt:'" << settings->lastUpdateDateFilePath << "'." << std::endl; ofs2 << "0" << std::endl; ofs2.close(); ifs.open(settings->lastUpdateDateFilePath); if(!ifs.is_open()) { perror(("Konnte die Datei '" + settings->lastUpdateDateFilePath + "' nicht öffnen").c_str()); if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Failed to open Last Update Date File:'" << settings->lastUpdateDateFilePath << "'." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Failed to open Last Update Date File:'" << settings->lastUpdateDateFilePath << "'." << std::endl; return 4545; } } @@ -505,7 +505,7 @@ int ProgramManager::checkLastUpdate(Settings *settings, ssize_t *days = nullptr) if(!std::getline(ifs, line).good()) { perror("GetLine from Date failed"); if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Get the first Line of the LastUpdateDate File failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Get the first Line of the LastUpdateDate File failed." << std::endl; return 2; } else if( ( ( difDays = static_cast(pageManager.getDate()) - atoll(line.c_str()) )) >= settings->updateWarningDays) { @@ -520,7 +520,7 @@ int ProgramManager::checkLastUpdate(Settings *settings, ssize_t *days = nullptr) *days = difDays; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Exit with success." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Exit with success." << std::endl; return 0; } @@ -570,13 +570,13 @@ int ProgramManager::defaultModus(Settings *settings) int res = 0; if( ( res = sucheNach_1_Serien(settings, pageManager, retVal) ) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien failed or found more options." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien failed or found more options." << std::endl; return (res == -10101) ? 0 : 202; } } else if( retVal.status == retVal.NO_WORKING_PAGE ) { std::cout << " => Error: Keine Funktionierende Internetseite!" << std::endl; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Keine Funktionierende Internetseite!" << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Keine Funktionierende Internetseite!" << std::endl; return 0; } @@ -592,7 +592,7 @@ int ProgramManager::defaultModus(Settings *settings) if(settings->default_checkPath != "") if(listDir(dirFiles, settings->default_checkPath, settings->default_maxDirs, settings->debugMode ) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": listDir failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": listDir failed." << std::endl; return 28; } if(dirFiles.length() > 0) //Entferne von der liste das \n am ende @@ -629,7 +629,7 @@ int ProgramManager::defaultModus(Settings *settings) if(settings->outputFilePaths.size() != 0 && !fileExists( settings->default_checkPath )) if(pageManager.writeToFile(settings->outputFilePaths, "Serie: " + settings->name + " (" + nameInUrl + ")" ) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile Function fails when write Name." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile Function fails when write Name." << std::endl; return 31; } @@ -657,7 +657,7 @@ int ProgramManager::defaultModus(Settings *settings) if(settings->maxThreads != 0) if(waitForThreads() != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; return 261; } if(settings->debugMode) @@ -669,7 +669,7 @@ int ProgramManager::defaultModus(Settings *settings) //Find out number of all episodes if( (tmp_reply = pageManager.getServerRequest(page.protocol, page.url + page.UrlDir + nameInUrl + "/staffel-" + std::to_string(staffel))).html == "-1") { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download season page." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download season page." << std::endl; return 40; } @@ -687,7 +687,7 @@ int ProgramManager::defaultModus(Settings *settings) if(settings->maxThreads != 0) if(waitForThreads() != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; return 261; } std::cout << " > Fertig, da Folge " << folge << " größer ist als Stopfolge " << settings->stopEpisode << "."<< std::endl; @@ -699,7 +699,7 @@ int ProgramManager::defaultModus(Settings *settings) if(settings->maxThreads != 0) if(waitForThreads() != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; return 267; } std::cout << " > Fertig, da Folge " << folge << " größer ist als Stopfolge " << settings->stopEpisode << std::endl @@ -726,14 +726,14 @@ int ProgramManager::defaultModus(Settings *settings) if(pthread_create(&threadList[nextThread]->thread, nullptr, threadFunction, reinterpret_cast(threadList[nextThread])) != 0 ) { perror("pthread_creat failed"); if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Create thread for redirect converting failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Create thread for redirect converting failed." << std::endl; return 48; } ++nextThread; } else { // Sonnst warte bis alle Fertig sind und restarte die Folge if(waitForThreads() != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; return 231; } nextThread=0; @@ -747,7 +747,7 @@ int ProgramManager::defaultModus(Settings *settings) tmp_reply =pageManager.getServerRequest( page.protocol, page.url + page.UrlDir + nameInUrl + "/staffel-" + std::to_string(staffel) + "/episode-" + std::to_string(folge)); if(tmp_reply.html == "-1") { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download episoden page." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download episoden page." << std::endl; return 50; } std::string allLinks = pageManager.getLinks(tmp_reply.html); @@ -767,13 +767,13 @@ int ProgramManager::defaultModus(Settings *settings) line.erase(line.find("\"")); if(convertLink(page, line, &accountManager, settings, staffel, folge, allLinks) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": convertLink failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": convertLink failed." << std::endl; return 51; } } //Stop beacause same episode every account can only 2 videos not 10-12 if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Stop Program, because '*'-Hoster is inperformatnt: Every Account can only 2 Vidoes not 10-12." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Stop Program, because '*'-Hoster is inperformatnt: Every Account can only 2 Vidoes not 10-12." << std::endl; return 0; } else { @@ -783,7 +783,7 @@ int ProgramManager::defaultModus(Settings *settings) std::cout << allLinks << std::endl << ( (Link == "") ? "" : " -> Link: 'https://" + page.url) << Link << ( (Link == "") ? "" : "'\n" ); if(convertLink(page, Link, &accountManager, settings, staffel, folge, allLinks) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl; return 51; } } @@ -798,7 +798,7 @@ int ProgramManager::defaultModus(Settings *settings) if(settings->maxThreads != 0) if(waitForThreads() != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; return 292; } @@ -869,13 +869,13 @@ int ProgramManager::directLinkModus(Settings *settings) if(convertLink(page, redL, &accountManager, settings) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl; return 78; } } if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Success." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Success." << std::endl; return 0; } @@ -929,7 +929,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no std::cout << "Erfolgreich geupdatet: Die Serienliste ist nun auf dem neusten Stand." << std::endl; if (settings->name == "") { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Stop after Update: No Name => Only Updating." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Stop after Update: No Name => Only Updating." << std::endl; return 0; } @@ -951,7 +951,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no //Check for last Update.. (glaub hier nocghmal die funktion, um datei zu erstellen, auch wenn ausgabe deaktiviert is, kann aber auch sein dass der teil ghier weg gehört) if(checkLastUpdate(settings) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": checkLastUpdate function failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": checkLastUpdate function failed." << std::endl; return -1; } @@ -961,7 +961,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no std::cout << " => Keine SerienListe vorhanden. Erstelle eine neue..." << std::endl; if(searchModus_update(settings) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": searchModus_update function failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": searchModus_update function failed." << std::endl; return 354; } else { @@ -1130,7 +1130,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": success." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": success." << std::endl; return 0; } @@ -1152,13 +1152,13 @@ int ProgramManager::infoModus(Settings *settings) int res = 0; if( ( res = sucheNach_1_Serien(settings, pageManager, retV) ) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien function failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien function failed." << std::endl; return (res == -10101) ? 0 : 28; } } else if( retV.status == retV.NO_WORKING_PAGE ) { std::cout << " => Error: Keine Funktionierende Internetseite!" << std::endl; if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": Keine Funktionierende Internetseite!" << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": Keine Funktionierende Internetseite!" << std::endl; return 0; } std::string nameInUrl = retV.url_name; @@ -1171,7 +1171,7 @@ int ProgramManager::infoModus(Settings *settings) if( !settings->no_log && pageManager.writeToFile(settings->outputFilePaths, "\n\nSerie: " + settings->name + " (" + nameInUrl + ")") != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 100; } @@ -1180,7 +1180,7 @@ int ProgramManager::infoModus(Settings *settings) Reply tmp_reply = pageManager.getServerRequest(page.protocol, page.url + page.UrlDir + nameInUrl); if(tmp_reply.html == "-1") { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at homepage." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at homepage." << std::endl; return 32; } @@ -1204,7 +1204,7 @@ int ProgramManager::infoModus(Settings *settings) Reply tmpReply = pageManager.getServerRequest(page.protocol, page.url + page.UrlDir + nameInUrl + "/staffel-" + std::to_string(staffel)); if(tmpReply.html == "-1") { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at season page." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at season page." << std::endl; return 40; } @@ -1216,7 +1216,7 @@ int ProgramManager::infoModus(Settings *settings) + " hat " + std::to_string(folgen) + " Folge" + ((folgen > 1) ? "n" : "") + ".\n") != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 110; } @@ -1261,7 +1261,7 @@ int ProgramManager::infoModus(Settings *settings) + std::to_string(gesammtFolge) + " ( S" + ( (staffel < 10) ? "0" : "" ) + std::to_string(staffel) + "E" + ( ( atoi( line.substr(0, pos).c_str() ) < 10) ? "0" : "" ) + line.substr(0, pos) + " ):" ) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 105; } @@ -1279,7 +1279,7 @@ int ProgramManager::infoModus(Settings *settings) std::cout << lila << " > Titel 1: " << Lightyellow << titel << white << std::endl; if(!settings->no_log && pageManager.writeToFile(settings->outputFilePaths, " > Titel 1: " + titel) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 110; } } @@ -1298,7 +1298,7 @@ int ProgramManager::infoModus(Settings *settings) std::cout << lila << " > Titel 2: " << Darkyellow << titel << white << std::endl; if(!settings->no_log && pageManager.writeToFile(settings->outputFilePaths, " > Titel 2: " + titel) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 120; } @@ -1358,16 +1358,9 @@ int ProgramManager::infoModus(Settings *settings) } std::string description = replace( replace( tmp_reply.html.substr(pos + 23, pos2 - pos - 23), "\n", "" ), "
", "" ); - //remove bug text: + //remove html special characters in text: description = replace(description, "&quot;", "\""); // - - description = replace(description, "&", "&"); // - description = replace(description, "<", "<"); // - description = replace(description, ">", ">"); // - - description = replace(description, "
", " "); // - description = replace(description, """, "\""); // - description = replace(description, "'", "'"); // + pageManager.replaceSZ(description); //Genres @@ -1401,7 +1394,7 @@ int ProgramManager::infoModus(Settings *settings) std::cout << lila << "\nProduktion von " << blue << startStopDates[0] << lila << " bis " << blue << startStopDates[1] << lila << std::endl << "FSK: " << blue << fsk << lila << std::endl - << "Cover Bild: " << green << coverLink << lila << std::endl + << "Cover Bild: " << green << page.protocol + page.url + coverLink << lila << std::endl << "Genre(s): " << blue << std::flush; for( const auto &e : genres) std::cout << e << " "; @@ -1419,7 +1412,7 @@ int ProgramManager::infoModus(Settings *settings) "\nBeschreibung: " + description + "\n") != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 130; } @@ -1432,7 +1425,7 @@ int ProgramManager::infoModus(Settings *settings) } if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": success exit." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": success exit." << std::endl; return 0; } @@ -1450,7 +1443,7 @@ int ProgramManager::newsModus(Settings *settings) std::string html = pageManager.getServerRequest(page.protocol, page.url +"/neue-episoden").html; if(html == "-1") { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; return 1; } @@ -1483,6 +1476,7 @@ int ProgramManager::newsModus(Settings *settings) return 4; } std::string name = line.substr(pos + 8, pos2 - pos - 8); + pageManager.replaceSZ(name); if( (pos = line.find("blue2\">")) == std::string::npos) { std::cout << " => Error: Konnte Position von 'blue2\">' nicht finden" < Error Keine Internet Seiten vorhanden." << std::endl; return -12; } - std::cout << "Pages: " << std::endl; - for( const auto &page : settings->pagesInUse ) { - std::cout << page.name_id << std::endl; - } +// std::cout << "Pages: " << std::endl; +// for( const auto &page : settings->pagesInUse ) { +// std::cout << page.name_id << std::endl; +// } for( const auto &page : settings->pagesInUse ) { std::cout << ((settings->colorless) ? "" : "\033[93m") << "Auf '" << page.url << "'..." << ((settings->colorless) ? "" : "\033[0m") << std::endl; @@ -1826,7 +1820,7 @@ int ProgramManager::printPopularSeries(Settings *settings) if(html == "-1") { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; return 1; } @@ -1879,6 +1873,8 @@ int ProgramManager::printPopularSeries(Settings *settings) continue; } std::string name = line.substr(pos + 4, pos2 - pos - 4); + pageManager.replaceSZ(name); + std::cout << " > Serie: " << ((settings->colorless) ? "" : "\033[96m") << name << ((settings->colorless) ? "" : "\033[0m") << ": " << ((settings->colorless) ? "" : "\033[92m") << "(" + replace(href,page.UrlDir, "") + ")" << ((settings->colorless) ? "" : "\033[0m") << std::endl; @@ -1915,7 +1911,7 @@ int ProgramManager::searchModus_update(Settings *settings) if(reply.html == "-1") { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; else std::cout << " -> Warnung: " << page.UrlDir << " ist fehlgeschlagen! " << std::endl; continue; @@ -1933,7 +1929,7 @@ int ProgramManager::searchModus_update(Settings *settings) for ( auto t : tests ) { if(reply.html.find( t ) == std::string::npos) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": html doesnt contain:'" << t << "' after preparing." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": html doesnt contain:'" << t << "' after preparing." << std::endl; std::cout << " -> Warnung: Überspringe: " << page.name_id << std::endl; cont = true;; } @@ -2128,7 +2124,7 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana std::cout << " => " << red << "KEINEN Hoster für die Folge " << replace(folgenID, "E", " E") << " gefunden." << ((settings->colorless) ? "" : "\033[0m") << std::endl; if(pageManager.writeToFile(settings->outputFilePaths, std::string("KEINEN Hoster für die Folge ") + replace(folgenID, "E", " E") + std::string(" gefunden.")) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 130; } } else { @@ -2138,7 +2134,7 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana "data-lang-key=\"2\"", "language=\"Eng\"" ), "data-lang-key=\"3\"", "language=\"GerSub\"") << std::endl; if(pageManager.writeToFile(settings->outputFilePaths, std::string("Keinen PASSENDEN Hoster für die Folge ") + replace(folgenID, "E", " E") + std::string(" gefunden.")) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 138; } } @@ -2153,7 +2149,7 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana //wenn function fehl schlug beende das Programm if (newUrl == "-1") { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": getUrlAfterRedirect f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": getUrlAfterRedirect f() failed." << std::endl; return 102; //wenn nach der Umwandlung https://seriens tream.sx/ vorhanden ist, die ist wenn der Link Ungültig war: @@ -2163,7 +2159,7 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana if(settings->outputFilePaths.size() != 0) if(pageManager.writeToFile(settings->outputFilePaths, replace(folgenID, "E", " E") + ( (folgenID == "") ? "" : ": " ) + "Ungültige Url: https://" + page.url + redirectLink) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 108; } return 0; @@ -2173,7 +2169,7 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana std::cout << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl; if(pageManager.login(page, accountManager->getNextAccount(), settings->cookieFilePath + "_" + page.url) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": login f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": login f() failed." << std::endl; return -1; } continue; @@ -2189,7 +2185,7 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana if(settings->outputFilePaths.size() != 0) if(pageManager.writeToFile(settings->outputFilePaths,folgenID + ( (folgenID == "") ? "" : ": " ) + newUrl) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 108; } return 0; @@ -2201,7 +2197,7 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana if(settings->outputFilePaths.size() != 0) { if(pageManager.writeToFile(settings->outputFilePaths, replace(folgenID, "E", " E") + ( (folgenID == "") ? "" : ": " ) + redirectLink) != 0) { if(settings->debugMode) - std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; + std::cout << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 114; } }