fix_new_site_changes

This commit is contained in:
Markus 2022-03-26 00:23:20 +01:00
parent 51be968f77
commit d37d5ab73e
9 changed files with 124 additions and 94 deletions

View File

@ -1,7 +1,7 @@
#include "accountManager.h" #include "accountManager.h"


AccountManager::AccountManager(std::string pathToFil, std::string pathToAccountNumberFile, PAGE page) AccountManager::AccountManager(std::string pathToFil, std::string pathToAccountNumberFile, PAGE page, const PAGE *pagesALL)
: pathToAccountNumberFile(pathToAccountNumberFile + "_" + page.name_id), pageInUse(page) : pagesALL(pagesALL), pathToAccountNumberFile(pathToAccountNumberFile + "_" + page.name_id), pageInUse(page)
{ {
std::string pathToAccountsFile = pathToFil + "_" + page.name_id; std::string pathToAccountsFile = pathToFil + "_" + page.name_id;
std::ifstream ifs(pathToAccountsFile); std::ifstream ifs(pathToAccountsFile);
@ -68,7 +68,21 @@ int AccountManager::writeDefault(std::string path)
ofs << "# <- Am Anfang der Zeile deaktiviert diese." << std::endl; ofs << "# <- Am Anfang der Zeile deaktiviert diese." << std::endl;
ofs << "#Email/Passwort - Falls diese gleich sind, geht auch nur Email oder Passwort" << std::endl; ofs << "#Email/Passwort - Falls diese gleich sind, geht auch nur Email oder Passwort" << std::endl;


if( pageInUse.url == "serienstream.sx" || pageInUse.url == "s.to" ) { enum pagesID {
STO,
ANICLOUD,
STOIP,
SERIENSTREAMSX,
SERIENCAM,
SERIENSTREAMTO
};

if( pageInUse.url == pagesALL[STO].url
|| pageInUse.url == pagesALL[STOIP].url
|| pageInUse.url == pagesALL[SERIENSTREAMSX].url
|| pageInUse.url == pagesALL[SERIENCAM].url
|| pageInUse.url == pagesALL[SERIENSTREAMTO].url)
{
ofs << "EntzueckendPackenderSkorpion@oida.icu" << std::endl; ofs << "EntzueckendPackenderSkorpion@oida.icu" << std::endl;
ofs << "HumorvollWundervollerDelfin@spam.care/HumorvollWundervollerDelfin@spam.care" << std::endl; ofs << "HumorvollWundervollerDelfin@spam.care/HumorvollWundervollerDelfin@spam.care" << std::endl;
ofs << "ExzellentPackenderHirsch@muell.icu/ExzellentPackenderHirsch@muell.icu" << std::endl; ofs << "ExzellentPackenderHirsch@muell.icu/ExzellentPackenderHirsch@muell.icu" << std::endl;
@ -160,7 +174,7 @@ int AccountManager::writeDefault(std::string path)
ofs << "BerauschendUnglaublicherGorilla@oida.icu" << std::endl; ofs << "BerauschendUnglaublicherGorilla@oida.icu" << std::endl;
ofs << "GenuesslichPraechtigerDachs@spam.care" << std::endl; ofs << "GenuesslichPraechtigerDachs@spam.care" << std::endl;


} else if( pageInUse.url == "anicloud.io" ) { } else if( pageInUse.url == pagesALL[ANICLOUD].url ) {
ofs << "C322334ark1954@teleworm.us/C322334ark1954@teleworm.us" << std::endl; ofs << "C322334ark1954@teleworm.us/C322334ark1954@teleworm.us" << std::endl;
ofs << "wemixex225@iconmle.com/wemixex225@iconmle.com" << std::endl; ofs << "wemixex225@iconmle.com/wemixex225@iconmle.com" << std::endl;
ofs << "Thw86757utary@teleworm.us" << std::endl; ofs << "Thw86757utary@teleworm.us" << std::endl;

View File

@ -19,9 +19,10 @@ struct Account {
class AccountManager class AccountManager
{ {
public: public:
AccountManager(std::string pathToFile, std::string pathToAccountNumberFile, PAGE page); AccountManager(std::string pathToFile, std::string pathToAccountNumberFile, PAGE page, const PAGE * pagesALL);
Account getNextAccount(); Account getNextAccount();
size_t getLastAccountNumber(); size_t getLastAccountNumber();
const PAGE * pagesALL;


private: private:
std::vector<Account> accounts; std::vector<Account> accounts;

View File

@ -1,7 +1,7 @@
#include "logger.h" #include "logger.h"


Logger::Logger(std::string logFilePath) Logger::Logger(std::string logFilePathm)
: filePath(logFilePath) : filePath(logFilePathm)
{ {
if(openFile(filePath)) if(openFile(filePath))
exit(234); exit(234);

View File

@ -10,11 +10,13 @@
#include <ctime> // std::time, localtime ... #include <ctime> // std::time, localtime ...




#include "parameterManager.h"



class Logger class Logger
{ {
public: public:
Logger(std::string logFilePath); Logger(std::string logFilePathm);
~Logger(); ~Logger();
std::string getFilePath(); std::string getFilePath();
std::fstream file; std::fstream file;
@ -24,6 +26,7 @@ public:
std::string getLogText(); std::string getLogText();
int clearFile(); int clearFile();



private: private:
std::string filePath; std::string filePath;
int writetoFile(std::string t); int writetoFile(std::string t);

View File

@ -78,8 +78,10 @@ void PageManager::get_terminal_size(int& width) {
#endif // Windows/Linux #endif // Windows/Linux
} }


Reply PageManager::getServerRequest(std::string Url, bool useCookies, std::string data, bool generateCookieFile, bool UrlAfterRedirectOnlyNeeded, std::string cookieFilePath) Reply PageManager::getServerRequest(std::string protocol, std::string Url, bool useCookies, std::string data, bool generateCookieFile, bool UrlAfterRedirectOnlyNeeded, std::string cookieFilePath)
{ {
Url = protocol + Url; // add https://

CURL *curl; CURL *curl;
CURLcode res; CURLcode res;
std::string readBuffer; std::string readBuffer;
@ -264,9 +266,13 @@ int PageManager::login(PAGE page, Account account, std::string cookieFilePath)
if(debugMode) if(debugMode)
std::cout << " > Melde mit neuem Account an: Email: " << account.Email << " Passowort: " << account.Password << std::endl; std::cout << " > Melde mit neuem Account an: Email: " << account.Email << " Passowort: " << account.Password << std::endl;


auto reply = getServerRequest("https://" + page.url + "/login", false, std::string("email=" + account.Email + "&password=" + account.Password), true, false, cookieFilePath ); auto reply = getServerRequest( page.protocol, page.url + "/login", false, std::string("email=" + account.Email + "&password=" + account.Password), true, false, cookieFilePath );
std::string html = reply.html; std::string html = reply.html;


auto fs = std::vector<std::string>();
fs.push_back("/home/markus/aaaaaaaaaaaaaaaaaaaaaaaa.html");
this->writeToFile(fs, html);

if(html == "" ) if(html == "" )
return 0; return 0;
else if (html.find("Das Feld Email muss eine gültige E-Mail-Adresse enthalten.") != std::string::npos) else if (html.find("Das Feld Email muss eine gültige E-Mail-Adresse enthalten.") != std::string::npos)
@ -278,6 +284,9 @@ int PageManager::login(PAGE page, Account account, std::string cookieFilePath)
else if (html.find("Ein Account mit dieser E-Mail Adresse wurde nicht gefunden.") != std::string::npos) else if (html.find("Ein Account mit dieser E-Mail Adresse wurde nicht gefunden.") != std::string::npos)
std::cout << " => Error: Login failed: Ein Account mit dieser E-Mail Adresse wurde nicht gefunden." << std::endl std::cout << " => Error: Login failed: Ein Account mit dieser E-Mail Adresse wurde nicht gefunden." << std::endl
<< " Email: '" << account.Email << "' Passwort: '" << account.Password << "'" << std::endl; << " Email: '" << account.Email << "' Passwort: '" << account.Password << "'" << std::endl;
else if (html.find("Dein Internetzugang wird zensiert (DNS-Sperre)" ) != std::string::npos)
std::cout << " => Error: Login failed: Dein Internetzugang wird zensiert (DNS-Sperre) -> Verwende IP?" << std::endl
<< " Email: '" << account.Email << "' Passwort: '" << account.Password << "'" << std::endl;
else if(html == "-1") else if(html == "-1")
return -1; return -1;
else else
@ -286,9 +295,9 @@ int PageManager::login(PAGE page, Account account, std::string cookieFilePath)
return -1; return -1;
} }


Reply PageManager::getUrlAfterRedirect(std::string Url, std::string cookieFilePath) Reply PageManager::getUrlAfterRedirect( std::string p,std::string Url, std::string cookieFilePath)
{ {
return getServerRequest(Url, true, "", false, true, cookieFilePath); return getServerRequest(p , Url, true, "", false, true, cookieFilePath);
} }


checkNameRply PageManager::checkName(std::vector<PAGE> pages, std::string Name, bool useFirstPage) checkNameRply PageManager::checkName(std::vector<PAGE> pages, std::string Name, bool useFirstPage)
@ -309,16 +318,17 @@ checkNameRply PageManager::checkName(std::vector<PAGE> pages, std::string Name,
//für jede Seite //für jede Seite
for ( const auto &p : pages ) { for ( const auto &p : pages ) {


std::string html = getServerRequest("https://" + p.url + p.UrlDir + name).html; std::string html = getServerRequest(p.protocol, p.url + p.UrlDir + name).html;
if(html.find("Die gewünschte Serie wurde nicht gefunden oder ist im Moment deaktiviert.") != std::string::npos) { if(html.find("Die gewünschte Serie wurde nicht gefunden oder ist im Moment deaktiviert.") != std::string::npos) {
continue; continue;


} else if (html.find("404 - Seite nicht gefunden") != std::string::npos) { } else if (html.find("404 - Seite nicht gefunden") != std::string::npos) {
std::cout << "\33[2K\r" <<" => Ungültiger Name: '" << Name << "'" << std::endl; std::cout << "\33[2K\r" <<" => Ungültiger Name: '" << Name << "'" << std::endl;
return checkNameRply("", PAGE(), checkNameRply::NOTHING_FOUND); continue;


} else if (html == "-1" || html == "") { } else if (html == "-1" || html == "") {
return checkNameRply("", PAGE(), checkNameRply::FAILED); std::cout << "\33[2K\r" <<" => WARNUNG: Das laden der Seite : '" << p.url << "' ist fehlgeschlagen" << std::endl;
continue;


} }
else { else {
@ -341,7 +351,7 @@ checkNameRply PageManager::checkName(std::vector<PAGE> pages, std::string Name,
} else if ( count > 1) { } else if ( count > 1) {
std::cout << "\33[2K\r => Die Serie existiert auf mehreren Seiten " << name << ": '" << pagesonExist << "'" << std::endl; std::cout << "\33[2K\r => Die Serie existiert auf mehreren Seiten " << name << ": '" << pagesonExist << "'" << std::endl;
std::cout << "\33[2K\r Benutze die Option -f --use-first, um automatisch die 1. Seite zu verwenden!" << std::endl; std::cout << "\33[2K\r Benutze die Option -f --use-first, um automatisch die 1. Seite zu verwenden!" << std::endl;
return checkNameRply("", PAGE(), checkNameRply::NOTHING_FOUND); //MULTIPLE OPTIONS FOUND!!!! return checkNameRply("", PAGE(), checkNameRply::NOTHING_FOUND); //MULTIPLE OPTIONS FOUND!!!! same option -> führe suche funktion aus
} else { } else {
std::cout << "\33[2K\r => Die gewünschte Serie wurde nicht gefunden oder ist im Moment deaktiviert: '" << Name << "'" << std::endl; std::cout << "\33[2K\r => Die gewünschte Serie wurde nicht gefunden oder ist im Moment deaktiviert: '" << Name << "'" << std::endl;
return checkNameRply("", PAGE(), checkNameRply::NOTHING_FOUND); return checkNameRply("", PAGE(), checkNameRply::NOTHING_FOUND);
@ -362,13 +372,15 @@ std::string PageManager::getLinks(std::string HTML)
//Entferne alles nach den Links //Entferne alles nach den Links
//pos = HTML.find("<script async="); //pos = HTML.find("<script async=");
//pos = HTML.find("<script data-cfasync=\""); //pos = HTML.find("<script data-cfasync=\"");
std::string points[] = { "<script async=", "<script data-cfasync=\"", "<div class=\"cf\"></div>" /*correkter HTML absatz*/, "<div id=\"footer\">", }; std::string points[] = { "<div class=\"cf\"></div>" /*correkter HTML absatz*/, "<script async=", "<script data-cfasync=\"", "<div id=\"footer\">", };
int b = 0;
for ( const auto &e : points ) { for ( const auto &e : points ) {
b++;
if( (pos = HTML.find(e)) == std::string::npos ) { if( (pos = HTML.find(e)) == std::string::npos ) {
if(debugMode) if(debugMode)
std::cerr << " => WARNUNG KONNTE Punkt' " << e << "' nicht nach den Links finden; nächster Versuch..." << std::endl; std::cerr << " => WARNUNG KONNTE Punkt' " << e << "' nicht nach den Links finden; nächster Versuch..." << std::endl;
} else { } else {
if(debugMode) if(debugMode && b > 1)
std::cerr << " => INFO: Punkt' " << e << "' gefunden an: " << pos << std::endl; std::cerr << " => INFO: Punkt' " << e << "' gefunden an: " << pos << std::endl;
break; break;
} }

View File

@ -47,11 +47,11 @@ public:


void get_terminal_size(int& width); void get_terminal_size(int& width);


Reply getServerRequest(std::string Url, bool useCookies = false, std::string data = "", bool generateCookieFile = false, bool UrlAfterRedirectOnlyNeeded = false, std::string cookieFilePath = ""); Reply getServerRequest(std::string protocol, std::string Url, bool useCookies = false, std::string data = "", bool generateCookieFile = false, bool UrlAfterRedirectOnlyNeeded = false, std::string cookieFilePath = "");
int downLoadToFile(std::string filePath, std::string url); int downLoadToFile(std::string filePath, std::string url);


int login(PAGE page, Account account, std::string cookieFilePath); int login(PAGE page, Account account, std::string cookieFilePath);
Reply getUrlAfterRedirect(std::string Url, std::string cookieFilePath); Reply getUrlAfterRedirect(std::string p, std::string Url, std::string cookieFilePath);
checkNameRply checkName(std::vector<PAGE> pages, std::string Name, bool useFirstPage); checkNameRply checkName(std::vector<PAGE> pages, std::string Name, bool useFirstPage);
std::string getLinks(std::string HTML); std::string getLinks(std::string HTML);
std::string chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first, bool withWarnMsg); std::string chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first, bool withWarnMsg);

View File

@ -212,6 +212,9 @@ int loadDefaulOptions(Settings &settings)
ofs << "# -> Standart Wert für Parameter: -i, --internet-pages:" << std::endl; ofs << "# -> Standart Wert für Parameter: -i, --internet-pages:" << std::endl;
ofs << "# -> Internetseiten, auf denen die die Serie gesucht wird. " << std::endl; ofs << "# -> Internetseiten, auf denen die die Serie gesucht wird. " << std::endl;
ofs << "# (anicloud.ion/serienstream.sx) - Der Priorität nach angeben!" << std::endl; ofs << "# (anicloud.ion/serienstream.sx) - Der Priorität nach angeben!" << std::endl;
ofs << "# Kombinierbar mit -f - Verwende erste Seite" << std::endl;
ofs << "# Unterstützte Seiten:" << std::endl;
ofs << "# s.to, 190.115.18.20, anicloud.io, serienstream.to, serienstream.sx, serien.cam" << std::endl;
ofs << "Internetseiten=anicloud.io,serienstream.sx" << std::endl << std::endl; ofs << "Internetseiten=anicloud.io,serienstream.sx" << std::endl << std::endl;


ofs << "# -> Standart Wert für Parameter: -f, --use-first:" << std::endl; ofs << "# -> Standart Wert für Parameter: -f, --use-first:" << std::endl;
@ -832,21 +835,13 @@ int unterOption_url(Settings *settings, int argc, char **argv)
case 's': case 's':
if(!optarg) if(!optarg)
break; break;
if( std::string(optarg) == settings->sto.url || std::string(optarg) == "s.to" ) { for( auto &i : settings->pagesALL ) {
settings->direktLink_explizitPage = settings->sto; if( std::string(optarg) == i.url ) {
if(settings->debugMode) settings->direktLink_explizitPage = i;
std::cout << " > Defaults: Standart-Page-für-direkt-link-mode: " << settings->sto.url << std::endl; if(settings->debugMode)

std::cout << " > Defaults: Standart-Page-für-direkt-link-mode: " << i.url << std::endl;
} else if ( std::string(optarg) == settings->anicio.url ) { }
settings->direktLink_explizitPage = settings->anicio;
if(settings->debugMode)
std::cout << " > Defaults: Standart-Page-für-direkt-link-mode: " << settings->anicio.url << std::endl;

} else {
std::cout << " Error_Defaults: Standart-Page-für-direkt-link-mode : Unbekannte Seite: " << optarg << std::endl;
return 2154;
} }

break; break;
case 'd': case 'd':
settings->debugMode = true; settings->debugMode = true;
@ -1225,7 +1220,7 @@ void unterOption_clean(Settings * settings, int argc, char **argv)
} }
} }
//UM sachen nach multipage update zu löschen //UM sachen nach multipage update zu löschen
for ( const auto &p : settings->pages ) { for ( const auto &p : settings->pagesInUse ) {
if(fileExists(settings->cookieFilePath + "_" + p.name_id)) { if(fileExists(settings->cookieFilePath + "_" + p.name_id)) {
if(remove((settings->cookieFilePath + "_" + p.name_id).c_str()) != 0) { if(remove((settings->cookieFilePath + "_" + p.name_id).c_str()) != 0) {
perror(( " => Error: Das löschen von " + settings->cookieFilePath + "_" + p.name_id + " ist fehlgeschlagen: ").c_str()); perror(( " => Error: Das löschen von " + settings->cookieFilePath + "_" + p.name_id + " ist fehlgeschlagen: ").c_str());
@ -1831,7 +1826,7 @@ std::string replace(std::string str, std::string substr1, std::string substr2)
int setUpInternetPages(Settings &settings, std::string optarg) int setUpInternetPages(Settings &settings, std::string optarg)
{ {
//Lösche default //Lösche default
settings.pages.clear(); settings.pagesInUse.clear();


std::istringstream ss(optarg + ","); std::istringstream ss(optarg + ",");
std::string value; std::string value;
@ -1839,22 +1834,21 @@ int setUpInternetPages(Settings &settings, std::string optarg)
while(std::getline(ss, value, ',')) { while(std::getline(ss, value, ',')) {
if(value == "") if(value == "")
continue; continue;
if( value == settings.sto.url || value == "s.to" ) { bool found = false;
settings.pages.push_back(settings.sto); for( const auto & internetSeite : settings.pagesALL ) {
if(settings.debugMode) if( value == internetSeite.url ) {
std::cout << " > : Internetseiten pusback: " << settings.sto.url << std::endl; settings.pagesInUse.push_back( internetSeite );

if(settings.debugMode)
} else if ( value == settings.anicio.url ) { std::cout << " > : Internetseiten pusback: " << internetSeite.url << std::endl;
settings.pages.push_back(settings.anicio); found = true;
if(settings.debugMode) }
std::cout << " > : Internetseiten pusback: " << settings.anicio.url << std::endl; }

if( !found ) {
} else {
std::cout << " => Error: Unbekannte Internetseiten: " << value << " - Bitte überprüfen sie ihr Default File oder ggf. Parameter -i" << std::endl; std::cout << " => Error: Unbekannte Internetseiten: " << value << " - Bitte überprüfen sie ihr Default File oder ggf. Parameter -i" << std::endl;
return 2154; return 2154;
} }
} }
if(settings.pages.size() < 1) { if(settings.pagesInUse.size() < 1) {
std::cout << " => Keine Internetseiten angegeben! " << std::endl; std::cout << " => Keine Internetseiten angegeben! " << std::endl;
return 1236; return 1236;
} }

View File

@ -25,12 +25,11 @@






#include "logger.h"


#define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files=" #define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files="
#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files=" #define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files="
#define VERSION "5.1.1" #define VERSION "5.2.0"
#define DEFAULT_FILE_VERSION "2.2" #define DEFAULT_FILE_VERSION "2.3"


//default, anime, normal, //default, anime, normal,
//suche: für jede katego. eine //suche: für jede katego. eine
@ -54,14 +53,15 @@ enum Modus {


struct PAGE { struct PAGE {
PAGE() {} PAGE() {}
PAGE( std::string url, std::string nameID, std::string urlAphabetSerienList, std::string urlDir ) PAGE( std::string protocol, std::string url, std::string nameID, std::string urlAphabetSerienList, std::string urlDir )
: name_id(nameID), url(url), urlAlphabetSerienList(urlAphabetSerienList), UrlDir(urlDir) : protocol(protocol), name_id(nameID), url(url), urlAlphabetSerienList(urlAphabetSerienList), UrlDir(urlDir)
{ {


} }
std::string name_id, url, urlAlphabetSerienList, UrlDir; std::string protocol, name_id, url, urlAlphabetSerienList, UrlDir;
}; };


#include "logger.h"


//Wichtig nach MODUS UND PAGE DECLARATION //Wichtig nach MODUS UND PAGE DECLARATION
#include "pageManager.h" #include "pageManager.h"
@ -70,20 +70,24 @@ struct PAGE {
struct Settings { struct Settings {


const std::string programName = "S_New4"; const std::string programName = "S_New4";
PAGE sto = PAGE( "serienstream.sx", "Normale_Serien", "/serien-alphabet", "/serie/stream/"); const PAGE _sto = PAGE( "https://", "s.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
PAGE anicio = PAGE( "anicloud.io", "Animes", "/animes-alphabet", "/anime/stream/"); _stoIP = PAGE( "", "190.115.18.20", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
PAGE pagesALL[2] = { sto, anicio }; serienstreamto = PAGE("https://", "serienstream.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
seriencam = PAGE("https://", "serien.cam", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
_serienstreamsx = PAGE( "https://", "serienstream.sx", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),


_anicio = PAGE( "https://" , "anicloud.io", "Animes", "/animes-alphabet", "/anime/stream/");
const PAGE pagesALL[6] = { _sto, _anicio, _stoIP, _serienstreamsx, seriencam, serienstreamto };


std::vector<PAGE> pages; // Priority sorted std::vector<PAGE> pagesInUse; // Priority sorted
bool useFirstPage = false; bool useFirstPage = false;


PAGE direktLink_explizitPage; PAGE direktLink_explizitPage;




Settings() { Settings() {
pages.push_back( sto ); for(const auto &e : pagesALL)
pages.push_back( anicio ); pagesInUse.push_back( e );
} }


// Wenn das Betriebsystem x86 ist: // Wenn das Betriebsystem x86 ist:

View File

@ -60,7 +60,7 @@ void * threadFunction(void * data) {
myThreadData->exitState=0; myThreadData->exitState=0;




Reply tmp_reply = myThreadData->pageManager->getServerRequest( "https://" + myThreadData->page.url + myThreadData->page.UrlDir + myThreadData->nameInUrl Reply tmp_reply = myThreadData->pageManager->getServerRequest( myThreadData->page.protocol, myThreadData->page.url + myThreadData->page.UrlDir + myThreadData->nameInUrl
+ "/staffel-" + std::to_string(myThreadData->staffel) + "/episode-" + std::to_string(myThreadData->folge)); + "/staffel-" + std::to_string(myThreadData->staffel) + "/episode-" + std::to_string(myThreadData->folge));
if(tmp_reply.html == "-1") { if(tmp_reply.html == "-1") {
if(myThreadData->settings->debugMode) if(myThreadData->settings->debugMode)
@ -117,7 +117,7 @@ void * threadFunction(void * data) {
} }


for (int i = 1; i <= 3; ++i) { for (int i = 1; i <= 3; ++i) {
auto REPLy = myThreadData->pageManager->getUrlAfterRedirect("https://" + myThreadData->page.url + Link, myThreadData->settings->cookieFilePath + "_" + myThreadData->page.name_id); auto REPLy = myThreadData->pageManager->getUrlAfterRedirect( myThreadData->page.protocol, myThreadData->page.url + Link, myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url);
std::string newUrl = REPLy.url; std::string newUrl = REPLy.url;
if (newUrl == "-1") { if (newUrl == "-1") {
if(myThreadData->settings->debugMode) if(myThreadData->settings->debugMode)
@ -125,15 +125,15 @@ void * threadFunction(void * data) {
return myThreadData->setState(16); return myThreadData->setState(16);


// Get redirect link after getUrlAfterRedirect function // Get redirect link after getUrlAfterRedirect function
} else if (newUrl == "https://s.to" || newUrl == "https://" + myThreadData->page.url || REPLy.html.find("404 - Seite nicht gefunden") != std::string::npos || REPLy.html.find("403 Forbidden") != std::string::npos) { } else if (newUrl == "https://s.to" || newUrl == "http://190.115.18.20/" || newUrl == "https://" + myThreadData->page.url || REPLy.html.find("404 - Seite nicht gefunden") != std::string::npos || REPLy.html.find("403 Forbidden") != std::string::npos) {
if(myThreadData->settings->debugMode) if(myThreadData->settings->debugMode)
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": getUrlAfterRedirect Function failed: 404 - Seite nicht gefunden oder 403 Forbidden." << std::endl; std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": getUrlAfterRedirect Function failed: 404 - Seite nicht gefunden oder 403 Forbidden." << std::endl;
return myThreadData->setState(404); return myThreadData->setState(404);


} else if(newUrl.find("/" + myThreadData->page.url + "/redirect/") != std::string::npos ) { } else if(newUrl.find("/redirect/") != std::string::npos ) {
if(myThreadData->settings->debugMode) if(myThreadData->settings->debugMode)
std::cout << " > Thread " << myThreadData->id << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl; std::cout << " > Thread " << myThreadData->id << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl;
if(myThreadData->pageManager->login(myThreadData->page, myThreadData->accountManager->getNextAccount(), myThreadData->settings->cookieFilePath + "_" + myThreadData->page.name_id) != 0) { if(myThreadData->pageManager->login(myThreadData->page, myThreadData->accountManager->getNextAccount(), myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url) != 0) {
if(myThreadData->settings->debugMode) if(myThreadData->settings->debugMode)
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": login Function failed." << std::endl; std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": login Function failed." << std::endl;
return myThreadData->setState(17); return myThreadData->setState(17);
@ -204,7 +204,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
std::string gewollteSeitenUrl; std::string gewollteSeitenUrl;
int NO_ERROR_BUT_EXIT_RETURN = -10101; int NO_ERROR_BUT_EXIT_RETURN = -10101;


if(settings->pages.size() < 1) { if(settings->pagesInUse.size() < 1) {
std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl; std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl;
return 1290; return 1290;
} }
@ -341,7 +341,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana


//suche Seite aus sucheregbnis in settings... //suche Seite aus sucheregbnis in settings...
bool found = false; bool found = false;
for ( const auto & page : settings->pages ) { for ( const auto & page : settings->pagesInUse ) {
if( page.name_id == gewollteSeitenUrl || page.url == gewollteSeitenUrl) { if( page.name_id == gewollteSeitenUrl || page.url == gewollteSeitenUrl) {
newNameAndPage.pageInUse = page; newNameAndPage.pageInUse = page;
found = true; found = true;
@ -563,8 +563,8 @@ int ProgramManager::defaultModus(Settings *settings)






//Führe Function aus, die überprüft ob die serie existiert //Führe Function aus, die überprüft ob die serie existiert (einmal???)
auto retVal = pageManager.checkName(settings->pages, settings->name, settings->useFirstPage); auto retVal = pageManager.checkName(settings->pagesInUse, settings->name, settings->useFirstPage);


if(retVal.status == retVal.FAILED) if(retVal.status == retVal.FAILED)
return 67; return 67;
@ -580,7 +580,7 @@ int ProgramManager::defaultModus(Settings *settings)


std::string nameInUrl = retVal.name; std::string nameInUrl = retVal.name;
PAGE page = retVal.pageInUse; PAGE page = retVal.pageInUse;
AccountManager accountManager(settings->accountFilePath, settings->accountNumberPath, page); AccountManager accountManager(settings->accountFilePath, settings->accountNumberPath, page, settings->pagesALL);




/* Wenn multihtreading seaktiviert ist, normal login sonst bereite threads vor /* Wenn multihtreading seaktiviert ist, normal login sonst bereite threads vor
@ -592,9 +592,9 @@ int ProgramManager::defaultModus(Settings *settings)


if(settings->maxThreads > 0) { if(settings->maxThreads > 0) {
for (unsigned i = 0; i < settings->maxThreads; ++i) { for (unsigned i = 0; i < settings->maxThreads; ++i) {
if(dirExists(settings->cookieFilePath + "_" + page.name_id + std::to_string( i ))) { if(dirExists(settings->cookieFilePath + "_" + page.url + std::to_string( i ))) {
std::cout << " => Error: Kann Cokkie-File nicht erstellen: Es existiert bereits ein Ordner mit diesem Namen: \n '" std::cout << " => Error: Kann Cokkie-File nicht erstellen: Es existiert bereits ein Ordner mit diesem Namen: \n '"
<< settings->cookieFilePath + "_" + page.name_id + std::to_string( i ) << "'." << std::endl; << settings->cookieFilePath + "_" + page.url + std::to_string( i ) << "'." << std::endl;
return 174; return 174;
} }
PageManager * pm = new PageManager(settings->proxy_ip + ":" + std::to_string(settings->proxy_port)); PageManager * pm = new PageManager(settings->proxy_ip + ":" + std::to_string(settings->proxy_port));
@ -618,7 +618,7 @@ int ProgramManager::defaultModus(Settings *settings)


//Finde die anzahl der staffel heraus: //Finde die anzahl der staffel heraus:
//download html von der startpage einer serie //download html von der startpage einer serie
Reply tmp_reply = pageManager.getServerRequest("https://" + page.url + page.UrlDir + nameInUrl); Reply tmp_reply = pageManager.getServerRequest(page.protocol, page.url + page.UrlDir + nameInUrl);
if(tmp_reply.html == "-1" || tmp_reply.html == "") { if(tmp_reply.html == "-1" || tmp_reply.html == "") {
std::cerr << " => Error: Konnte Seitenquelltext nicht herunterladen." << std::endl; std::cerr << " => Error: Konnte Seitenquelltext nicht herunterladen." << std::endl;
return 32; return 32;
@ -650,7 +650,7 @@ int ProgramManager::defaultModus(Settings *settings)
} }


//Find out number of all episodes //Find out number of all episodes
if( (tmp_reply = pageManager.getServerRequest("https://" + page.url + page.UrlDir + nameInUrl + "/staffel-" + std::to_string(staffel))).html == "-1") { if( (tmp_reply = pageManager.getServerRequest(page.protocol, page.url + page.UrlDir + nameInUrl + "/staffel-" + std::to_string(staffel))).html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download season page." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download season page." << std::endl;
return 40; return 40;
@ -727,7 +727,7 @@ int ProgramManager::defaultModus(Settings *settings)


// Default Mode // Default Mode
} else { } else {
tmp_reply =pageManager.getServerRequest( "https://" + page.url + page.UrlDir + nameInUrl + "/staffel-" + std::to_string(staffel) + "/episode-" + std::to_string(folge)); 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(tmp_reply.html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download episoden page." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download episoden page." << std::endl;
@ -828,7 +828,7 @@ int ProgramManager::directLinkModus(Settings *settings)
line.erase(0, line.find("://") + 3); // remove http(s):// line.erase(0, line.find("://") + 3); // remove http(s)://
std::string url = line.substr(0, line.find("/redirect/")); std::string url = line.substr(0, line.find("/redirect/"));
bool found = false; bool found = false;
for( const auto &p : settings->pages ) { for( const auto &p : settings->pagesInUse ) {
if(p.url == url) { if(p.url == url) {
found = true; found = true;
page = p; page = p;
@ -842,7 +842,7 @@ int ProgramManager::directLinkModus(Settings *settings)
redL = line.erase(0, line.find("/redirect/")); redL = line.erase(0, line.find("/redirect/"));
} }


AccountManager accountManager(settings->accountFilePath, settings->accountNumberPath, page); AccountManager accountManager(settings->accountFilePath, settings->accountNumberPath, page, settings->pagesALL);


if(convertLink(page, redL, &accountManager, settings) != 0) { if(convertLink(page, redL, &accountManager, settings) != 0) {
if(settings->debugMode) if(settings->debugMode)
@ -943,7 +943,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no
//------------------------------------------------> Extrahiere alle Zeilen raus, die aus den Aktivierten Seiten sind //------------------------------------------------> Extrahiere alle Zeilen raus, die aus den Aktivierten Seiten sind
std::istringstream ifS(fullList + "\n"); std::istringstream ifS(fullList + "\n");
std::string l, allUrlsInUSe, allPages; std::string l, allUrlsInUSe, allPages;
for( const auto &p : settings->pages ) for( const auto &p : settings->pagesInUse )
allUrlsInUSe += ((allUrlsInUSe == "") ? "" : ",") + p.url; allUrlsInUSe += ((allUrlsInUSe == "") ? "" : ",") + p.url;
for( const auto &p : settings->pagesALL ) for( const auto &p : settings->pagesALL )
allPages += ((allPages == "") ? "" : ",") + p.url; allPages += ((allPages == "") ? "" : ",") + p.url;
@ -1037,7 +1037,7 @@ int ProgramManager::infoModus(Settings *settings)
} }


//Führe Function aus, die überprüft ob die serie existiert //Führe Function aus, die überprüft ob die serie existiert
auto retV = pageManager.checkName(settings->pages, settings->name, settings->useFirstPage); auto retV = pageManager.checkName(settings->pagesInUse, settings->name, settings->useFirstPage);
if(retV.status == retV.FAILED) if(retV.status == retV.FAILED)
return 145; return 145;
else if(retV.status == retV.NOTHING_FOUND) { else if(retV.status == retV.NOTHING_FOUND) {
@ -1063,7 +1063,7 @@ int ProgramManager::infoModus(Settings *settings)




//Finde Anzahl der Staffel heraus: //Finde Anzahl der Staffel heraus:
Reply tmp_reply = pageManager.getServerRequest( "https://" + page.url + page.UrlDir + nameInUrl); Reply tmp_reply = pageManager.getServerRequest(page.protocol, page.url + page.UrlDir + nameInUrl);
if(tmp_reply.html == "-1") { if(tmp_reply.html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at homepage." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at homepage." << std::endl;
@ -1087,7 +1087,7 @@ int ProgramManager::infoModus(Settings *settings)


//Um namen der Folge für jede Staffel zu bekommen //Um namen der Folge für jede Staffel zu bekommen
for (int staffel = 1; staffel <= maxStaffel; ++staffel) { for (int staffel = 1; staffel <= maxStaffel; ++staffel) {
Reply tmpReply = pageManager.getServerRequest( "https://" + page.url + page.UrlDir + nameInUrl + "/staffel-" + std::to_string(staffel)); Reply tmpReply = pageManager.getServerRequest(page.protocol, page.url + page.UrlDir + nameInUrl + "/staffel-" + std::to_string(staffel));
if(tmpReply.html == "-1") { if(tmpReply.html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at season page." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at season page." << std::endl;
@ -1315,16 +1315,16 @@ int ProgramManager::infoModus(Settings *settings)


int ProgramManager::newsModus(Settings *settings) int ProgramManager::newsModus(Settings *settings)
{ {
if(settings->pages.size() < 1) { if(settings->pagesInUse.size() < 1) {
std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl; std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl;
return -12; return -12;
} }


for( const auto &page : settings->pages ) { for( const auto &page : settings->pagesInUse ) {
std::cout << ((settings->colorless) ? "" : "\033[93m") << "Auf '" << page.url << "'..." << ((settings->colorless) ? "" : "\033[0m") << std::endl; std::cout << ((settings->colorless) ? "" : "\033[93m") << "Auf '" << page.url << "'..." << ((settings->colorless) ? "" : "\033[0m") << std::endl;


size_t pos = 0; size_t pos = 0;
std::string html = pageManager.getServerRequest("https://" + page.url +"/neue-episoden").html; std::string html = pageManager.getServerRequest(page.protocol, page.url +"/neue-episoden").html;
if(html == "-1") { if(html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl;
@ -1403,10 +1403,10 @@ int ProgramManager::updateModus(Settings *settings)
} }


std::cout << " => INFO: Suche nach der neusten Version..." << std::endl; std::cout << " => INFO: Suche nach der neusten Version..." << std::endl;
std::string html = pageManager.getServerRequest( UpdaterCloudUrlWithPath + settings->VersionFileName).html; std::string html = pageManager.getServerRequest("", UpdaterCloudUrlWithPath + settings->VersionFileName).html;
if( html == "-1" || html == "" || html.find("\n") == std::string::npos) { if( html == "-1" || html == "" || html.find("\n") == std::string::npos) {
std::cerr << (" => Warnung: Verwende 2t-Link für Download!") << std::endl; std::cerr << (" => Warnung: Verwende 2t-Link für Download!") << std::endl;
html = pageManager.getServerRequest( SecondUpdaterCloudUrlWithPath + settings->VersionFileName).html; html = pageManager.getServerRequest( "", SecondUpdaterCloudUrlWithPath + settings->VersionFileName).html;
} }




@ -1689,7 +1689,7 @@ int ProgramManager::searchModus_update(Settings *settings)
{ {
std::string list; std::string list;
std::string line; std::string line;
if(settings->pages.size() < 1) { if(settings->pagesInUse.size() < 1) {
std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl; std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl;
return 1290; return 1290;
} }
@ -1697,15 +1697,17 @@ int ProgramManager::searchModus_update(Settings *settings)


//darf nicht weniger werden!! //darf nicht weniger werden!!


for ( const auto &page : settings->pagesALL ) { for ( const auto &page : settings->pagesInUse ) {
std::cout << " -> Updating '" << page.name_id << "'..." << std::endl; std::cout << " -> Updating '" << page.name_id << "'..." << std::endl;


Reply reply = pageManager.getServerRequest("https://" + page.url + page.urlAlphabetSerienList); Reply reply = pageManager.getServerRequest( page.protocol, page.url + page.urlAlphabetSerienList);


if(reply.html == "-1") { if(reply.html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl;
return 21; else
std::cout << " -> Warnung: " << page.UrlDir << " ist fehlgeschlagen! " << std::endl;
continue;
} }
else if(reply.html.find("</html>") == std::string::npos ) { else if(reply.html.find("</html>") == std::string::npos ) {
std::cout << " => Error: Konnte </html> in searchModus_update() nicht finden." << std::endl; std::cout << " => Error: Konnte </html> in searchModus_update() nicht finden." << std::endl;
@ -1934,7 +1936,7 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana
} }


for (int i = 1; i <= 3; ++i) { for (int i = 1; i <= 3; ++i) {
auto rEply = pageManager.getUrlAfterRedirect("https://" + page.url + redirectLink, settings->cookieFilePath + "_" + page.name_id); auto rEply = pageManager.getUrlAfterRedirect( page.protocol, page.url + redirectLink, settings->cookieFilePath + "_" + page.url);
std::string newUrl = rEply.url; std::string newUrl = rEply.url;


//wenn function fehl schlug beende das Programm //wenn function fehl schlug beende das Programm
@ -1944,7 +1946,7 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana
return 102; return 102;


//wenn nach der Umwandlung https://seriens tream.sx/ vorhanden ist, die ist wenn der Link Ungültig war: //wenn nach der Umwandlung https://seriens tream.sx/ vorhanden ist, die ist wenn der Link Ungültig war:
} else if (newUrl == "https://s.to" || newUrl == "https://" + page.url || rEply.html.find("404 - Seite nicht gefunden") != std::string::npos || rEply.html.find("403 Forbidden") != std::string::npos) { } else if (newUrl == "https://s.to" || newUrl == "http://190.115.18.20/" || newUrl == "https://" + page.url || rEply.html.find("404 - Seite nicht gefunden") != std::string::npos || rEply.html.find("403 Forbidden") != std::string::npos) {
std::cout << " => " << red << replace(folgenID, "E", " E") << ( (folgenID == "") ? "" : ": " ) << "Ungültige Url: 'https://" + page.url << redirectLink << "'" std::cout << " => " << red << replace(folgenID, "E", " E") << ( (folgenID == "") ? "" : ": " ) << "Ungültige Url: 'https://" + page.url << redirectLink << "'"
<< ((settings->colorless) ? "" : "\033[0m") << std::endl; << ((settings->colorless) ? "" : "\033[0m") << std::endl;
if(settings->outputFilePaths.size() != 0) if(settings->outputFilePaths.size() != 0)
@ -1955,10 +1957,10 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana
} }
return 0; return 0;
// wenn nach der Umwandlung immern och ein redirect vorhanden ist, also wenn z.B.: account gewechselt werden muss // wenn nach der Umwandlung immern och ein redirect vorhanden ist, also wenn z.B.: account gewechselt werden muss
} else if(newUrl.find("/" + page.url + "/redirect/") != std::string::npos ) { } else if(newUrl.find("/redirect/") != std::string::npos ) {
if(settings->debugMode) if(settings->debugMode)
std::cout << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl; std::cout << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl;
if(pageManager.login(page, accountManager->getNextAccount(), settings->cookieFilePath + "_" + page.name_id) != 0) { if(pageManager.login(page, accountManager->getNextAccount(), settings->cookieFilePath + "_" + page.url) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": login f() failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": login f() failed." << std::endl;
return -1; return -1;