|
|
|
@ -54,7 +54,7 @@ void * threadFunction(void * data) {
|
|
|
|
|
myThreadData->exitState=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reply tmp_reply = myThreadData->pageManager->getServerRequest(myThreadData->pageManager->UrlPraefix + myThreadData->nameInUrl
|
|
|
|
|
Reply tmp_reply = myThreadData->pageManager->getServerRequest( "https://" + myThreadData->page.url + myThreadData->page.UrlDir + myThreadData->nameInUrl
|
|
|
|
|
+ "/staffel-" + std::to_string(myThreadData->staffel) + "/episode-" + std::to_string(myThreadData->folge));
|
|
|
|
|
if(tmp_reply.html == "-1") {
|
|
|
|
|
if(myThreadData->settings->debugMode)
|
|
|
|
@ -65,7 +65,7 @@ void * threadFunction(void * data) {
|
|
|
|
|
std::string Link = myThreadData->pageManager->chooseHosterLink(allLinks, myThreadData->settings->genaueHoster, myThreadData->settings->languages, myThreadData->settings->debugMode);
|
|
|
|
|
|
|
|
|
|
if(myThreadData->settings->debugMode)
|
|
|
|
|
std::cout << " > Thread " << myThreadData->id << allLinks << std::endl << ( (Link == "") ? "" : " -> Link: 'https://serienstream.sx") << Link << ( (Link == "") ? "" : "'\n" );
|
|
|
|
|
std::cout << " > Thread " << myThreadData->id << allLinks << std::endl << ( (Link == "") ? "" : " -> Link: 'https://" + myThreadData->page.url) << Link << ( (Link == "") ? "" : "'\n" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -111,17 +111,17 @@ void * threadFunction(void * data) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= 3; ++i) {
|
|
|
|
|
std::string newUrl = myThreadData->pageManager->getUrlAfterRedirect("https://serienstream.sx" + Link);
|
|
|
|
|
std::string newUrl = myThreadData->pageManager->getUrlAfterRedirect("https://" + myThreadData->page.url + Link);
|
|
|
|
|
if (newUrl == "-1") {
|
|
|
|
|
if(myThreadData->settings->debugMode)
|
|
|
|
|
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": getUrlAfterRedirect Function failed: returned -1." << std::endl;
|
|
|
|
|
return myThreadData->setState(16);
|
|
|
|
|
|
|
|
|
|
// Get redirect link after getUrlAfterRedirect function
|
|
|
|
|
} else if(newUrl.find("/serienstream.sx/redirect/") != std::string::npos ) {
|
|
|
|
|
} else if(newUrl.find("/" + myThreadData->page.url + "/redirect/") != std::string::npos ) {
|
|
|
|
|
if(myThreadData->settings->debugMode)
|
|
|
|
|
std::cout << " > Thread " << myThreadData->id << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl;
|
|
|
|
|
if(myThreadData->pageManager->login(myThreadData->accountManager->getNextAccount()) != 0) {
|
|
|
|
|
if(myThreadData->pageManager->login(myThreadData->page, myThreadData->accountManager->getNextAccount()) != 0) {
|
|
|
|
|
if(myThreadData->settings->debugMode)
|
|
|
|
|
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": login Function failed." << std::endl;
|
|
|
|
|
return myThreadData->setState(17);
|
|
|
|
@ -151,7 +151,7 @@ void * threadFunction(void * data) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//error at 3 time
|
|
|
|
|
myThreadData->returnValue = " => " + replace(folgenID, "E", " E") + ( (folgenID == "") ? "" : ": " ) + red + "https://serienstream.sx" + Link + clearColor;
|
|
|
|
|
myThreadData->returnValue = " => " + replace(folgenID, "E", " E") + ( (folgenID == "") ? "" : ": " ) + red + "https://" + myThreadData->page.url + Link + clearColor;
|
|
|
|
|
if(myThreadData->settings->outputFilePaths.size() != 0)
|
|
|
|
|
if(myThreadData->pageManager->writeToFile(myThreadData->settings->outputFilePaths, replace(folgenID, "E", " E") + ( (folgenID == "") ? "" : ": " ) + Link) != 0) {
|
|
|
|
|
if(myThreadData->settings->debugMode)
|
|
|
|
@ -183,9 +183,11 @@ int ProgramManager::waitForThreads()
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageManager, std::string &newName)
|
|
|
|
|
int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageManager, checkNameRply &newNameAndPage)
|
|
|
|
|
{
|
|
|
|
|
std::string finds;
|
|
|
|
|
std::string gewollteSeitenUrl;
|
|
|
|
|
|
|
|
|
|
//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)
|
|
|
|
@ -207,16 +209,30 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
|
|
|
|
|
std::string line;
|
|
|
|
|
|
|
|
|
|
std::cout << "\nWähle eine der folgenden Serien, oder nur [Enter] um Forgang abzubrechen." << std::endl;
|
|
|
|
|
std::string lastPage = "";
|
|
|
|
|
for (unsigned i = 1; std::getline(myStrStream, line).good() ; ++i) {
|
|
|
|
|
if(line.find_last_of("|") == std::string::npos) {
|
|
|
|
|
std::cout << " => Error: Invalid Line: " << line << std::endl;
|
|
|
|
|
return -21;
|
|
|
|
|
}
|
|
|
|
|
std::cout << i << ": " << line.substr(line.find_last_of("|") + 1) << ( (line[0] != '|') ? " ( " + line.substr(0, line.find("|")) + " )" : "" ) << std::endl;
|
|
|
|
|
|
|
|
|
|
std::string pageUrl = line.substr( line.find_last_of('|') + 1);
|
|
|
|
|
//gib neue Internet seite aus, wenn sie noch nicht ausgegeben wurde
|
|
|
|
|
if( lastPage != pageUrl) {
|
|
|
|
|
std::cout << "\n-> Auf '" << pageUrl << "':" << std::endl;
|
|
|
|
|
lastPage = pageUrl;
|
|
|
|
|
}
|
|
|
|
|
line.erase(line.find_last_of('|'));
|
|
|
|
|
|
|
|
|
|
if(line.find_last_of("|") == std::string::npos) {
|
|
|
|
|
std::cout << " => Error: Invalid Line: " << line << std::endl;
|
|
|
|
|
return -21;
|
|
|
|
|
}
|
|
|
|
|
std::cout << "[" << i << "]: " << line.substr(line.find_last_of("|") + 1) << ( (line[0] != '|') ? " ( " + line.substr(0, line.find("|")) + " )" : "" ) << std::endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Lass Benutzer Zeile auswählen:
|
|
|
|
|
std::cout << "Zeile: " << std::flush;
|
|
|
|
|
std::cout << "\nNummer: " << std::flush;
|
|
|
|
|
std::string input;
|
|
|
|
|
std::getline(std::cin, input);
|
|
|
|
|
|
|
|
|
@ -239,11 +255,17 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
|
|
|
|
|
|
|
|
|
|
// Wenn die Zeile gleich der ausgewählten ist:
|
|
|
|
|
} else if(static_cast<int>(i) == atoi(input.c_str()) ) {
|
|
|
|
|
//entferne und speichere PageUrl;
|
|
|
|
|
gewollteSeitenUrl = line.substr(line.find_last_of('|') + 1);
|
|
|
|
|
line.erase(line.find_last_of('|'));
|
|
|
|
|
|
|
|
|
|
//Speichere den Namen der Serie und setzte hasName auf true und brich schleife ab
|
|
|
|
|
if ( (finds = line.substr( line.find("|/") + 2, // beginn: nach dem |/
|
|
|
|
|
line.find("|", line.find("|/") + 2) // Bis zu dem | ab dem ende von |/
|
|
|
|
|
- line.find("|/") -2) ) == "" ) { // wegen nicht bi sondern länge, suptrahiere Pos 1
|
|
|
|
|
std::cout << " => Error: Konnte den Namen aus der zurückgegebenen Zeile nicht extrahieren. In ausWahlVariante" << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Return value from searchModus.subStr(pos(/)-> next |, after /) is ''." << std::endl;
|
|
|
|
|
return 48;
|
|
|
|
@ -260,6 +282,9 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
|
|
|
|
|
|
|
|
|
|
//Wenn nur 1 Serie gefunden wurde:
|
|
|
|
|
} else {
|
|
|
|
|
//entferne und speichere PageUrl;
|
|
|
|
|
gewollteSeitenUrl = finds.substr(finds.find_last_of('|') + 1);
|
|
|
|
|
finds.erase(finds.find_last_of('|'));
|
|
|
|
|
|
|
|
|
|
//Frag den User ob das die Richtige Serie ist:
|
|
|
|
|
std::cout << " -> Ist das deine gewünschte Serie: '"
|
|
|
|
@ -286,19 +311,43 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
std::cout << "NAME: " << finds << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//suche Seite aus sucheregbnis in settings...
|
|
|
|
|
bool found = false;
|
|
|
|
|
for ( const auto & page : settings->pages ) {
|
|
|
|
|
if( page.name_id == gewollteSeitenUrl || page.url == gewollteSeitenUrl) {
|
|
|
|
|
newNameAndPage.pageInUse = page;
|
|
|
|
|
found = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
return 45;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Überprüfe ob es die serie gibt wenn ja speicher ihn in newname und beende Function
|
|
|
|
|
//<>/newName = pageManager.checkName(finds);
|
|
|
|
|
if(newName == "-2")
|
|
|
|
|
//test jetzt nicht mehr alle seiten, sondern die die ausgewählt wurde!!!!!
|
|
|
|
|
std::vector<PAGE> pages;
|
|
|
|
|
pages.push_back( newNameAndPage.pageInUse );
|
|
|
|
|
|
|
|
|
|
auto ret = pageManager.checkName( pages /*settings->pages dann glaub ich immer fehler, wenn serie auf 2 seiten excistiert*/, finds);
|
|
|
|
|
if(ret.status == ret.FAILED)
|
|
|
|
|
return 23;
|
|
|
|
|
else if( newName == "-1" ) {
|
|
|
|
|
else if( ret.status == ret.NEEDHELP ) {
|
|
|
|
|
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;
|
|
|
|
|
return 47;
|
|
|
|
|
} else {
|
|
|
|
|
//speichere neuen Namen in übergebenen ref var
|
|
|
|
|
newNameAndPage.name = ret.name;
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Use new SerienName: '" << newName << "'." << std::endl;
|
|
|
|
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Use new SerienName: '" << ret.name << "'." << std::endl;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -394,22 +443,27 @@ int ProgramManager::defaultModus(Settings *settings)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Führe Function aus, die überprüft ob die serie existiert
|
|
|
|
|
std::string nameInUrl =pageManager.checkName(settings->pages, settings->name);
|
|
|
|
|
if(nameInUrl == "-2")
|
|
|
|
|
auto retVal = pageManager.checkName(settings->pages, settings->name);
|
|
|
|
|
|
|
|
|
|
if(retVal.status == retVal.FAILED)
|
|
|
|
|
return 67;
|
|
|
|
|
else if(nameInUrl == "-1") {
|
|
|
|
|
else if(retVal.status == retVal.NEEDHELP) {
|
|
|
|
|
//Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch && Wenn nur 1ne dacnn frag ob es diese ist.
|
|
|
|
|
int res = 0;
|
|
|
|
|
if( ( res = sucheNach_1_Serien(settings, pageManager, nameInUrl) ) != 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;
|
|
|
|
|
return (res == -10101) ? 0 : 202;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
std::string nameInUrl = retVal.name;
|
|
|
|
|
PAGE page = retVal.pageInUse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Wenn multihtreading seaktiviert ist, normal login sonst bereite threads vor
|
|
|
|
|
if(settings->maxThreads == 0) {
|
|
|
|
|
// melde bei serienstream.sx an und speicher cookies.
|
|
|
|
|
// melde bei seriens tream.sx an und speicher cookies.
|
|
|
|
|
if (pageManager.login(accountManager.getNextAccount()) != 0) //----------------------------------------
|
|
|
|
|
return 29;
|
|
|
|
|
}*/
|
|
|
|
@ -427,7 +481,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
|
|
|
|
//pm->setProxy(settings->proxy_ip, settings->proxy_port);
|
|
|
|
|
//pm->setCookieFilePath(settings->cookieFilePath + std::to_string( i ));
|
|
|
|
|
|
|
|
|
|
ThreadData * newThreadData = new ThreadData(i, 0, nameInUrl, -1, settings, &accountManager, pm);
|
|
|
|
|
ThreadData * newThreadData = new ThreadData(i, 0, nameInUrl, -1, settings, &accountManager, pm, page);
|
|
|
|
|
threadList.push_back(newThreadData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -442,7 +496,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
|
|
|
|
|
|
|
|
|
//Finde die anzahl der staffel heraus:
|
|
|
|
|
//download html von der startpage einer serie
|
|
|
|
|
Reply tmp_reply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl);
|
|
|
|
|
Reply tmp_reply = pageManager.getServerRequest("https://" + page.url + page.UrlDir + nameInUrl);
|
|
|
|
|
if(tmp_reply.html == "-1" || tmp_reply.html == "") {
|
|
|
|
|
std::cerr << " => Error: Konnte Seitenquelltext nicht herunterladen." << std::endl;
|
|
|
|
|
return 32;
|
|
|
|
@ -474,7 +528,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Find out number of all episodes
|
|
|
|
|
if( (tmp_reply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel))).html == "-1") {
|
|
|
|
|
if( (tmp_reply = pageManager.getServerRequest("https://" + 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;
|
|
|
|
|
return 40;
|
|
|
|
@ -551,7 +605,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
|
|
|
|
|
|
|
|
|
// Default Mode
|
|
|
|
|
} else {
|
|
|
|
|
tmp_reply =pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel) + "/episode-" + std::to_string(folge));
|
|
|
|
|
tmp_reply =pageManager.getServerRequest( "https://" + 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;
|
|
|
|
@ -572,7 +626,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
|
|
|
|
} else
|
|
|
|
|
line.erase(0, pos);
|
|
|
|
|
line.erase(line.find("\""));
|
|
|
|
|
if(convertLink(line, &accountManager, settings, staffel, folge, allLinks) != 0) {
|
|
|
|
|
if(convertLink(page, line, &accountManager, settings, staffel, folge, allLinks) != 0) {
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": convertLink failed." << std::endl;
|
|
|
|
|
return 51;
|
|
|
|
@ -587,8 +641,8 @@ int ProgramManager::defaultModus(Settings *settings)
|
|
|
|
|
std::string Link = pageManager.chooseHosterLink(allLinks, settings->genaueHoster, settings->languages, settings->debugMode);
|
|
|
|
|
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
|
std::cout << allLinks << std::endl << ( (Link == "") ? "" : " -> Link: 'https://serienstream.sx") << Link << ( (Link == "") ? "" : "'\n" );
|
|
|
|
|
if(convertLink(Link, &accountManager, settings, staffel, folge, allLinks) != 0) {
|
|
|
|
|
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;
|
|
|
|
|
return 51;
|
|
|
|
@ -635,7 +689,7 @@ int ProgramManager::directLinkModus(Settings *settings)
|
|
|
|
|
std::cout << " => Error: Invalid Redirect Link: '" << line << "'" << std::endl;
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
} else if(convertLink(line.erase(0, line.find("/redirect/") ), &accountManager, settings) != 0) {
|
|
|
|
|
} else if(convertLink(PAGE("", ""), line.erase(0, line.find("/redirect/") ), &accountManager, settings) != 0) {
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl;
|
|
|
|
|
return 78;
|
|
|
|
@ -797,18 +851,21 @@ int ProgramManager::infoModus(Settings *settings)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Führe Function aus, die überprüft ob die serie existiert
|
|
|
|
|
std::string nameInUrl;//<>/ = pageManager.checkName(settings->name);
|
|
|
|
|
if(nameInUrl == "-2")
|
|
|
|
|
auto retV = pageManager.checkName(settings->pages, settings->name);
|
|
|
|
|
if(retV.status == retV.FAILED)
|
|
|
|
|
return 145;
|
|
|
|
|
else if(nameInUrl == "-1") {
|
|
|
|
|
else if(retV.status == retV.NEEDHELP) {
|
|
|
|
|
//Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch.
|
|
|
|
|
int res = 0;
|
|
|
|
|
if( ( res = sucheNach_1_Serien(settings, pageManager, nameInUrl) ) != 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;
|
|
|
|
|
return (res = -10101) ? 0 : 28;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
std::string nameInUrl = retV.name;
|
|
|
|
|
PAGE page = retV.pageInUse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//write Name to file
|
|
|
|
|
if(pageManager.writeToFile(settings->outputFilePaths, "\n\nSerie: " + settings->name + " (" + nameInUrl + ")") != 0)
|
|
|
|
@ -820,7 +877,7 @@ int ProgramManager::infoModus(Settings *settings)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Finde Anzahl der Staffel heraus:
|
|
|
|
|
Reply tmp_reply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl);
|
|
|
|
|
Reply tmp_reply = pageManager.getServerRequest( "https://" + 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;
|
|
|
|
@ -844,7 +901,7 @@ int ProgramManager::infoModus(Settings *settings)
|
|
|
|
|
|
|
|
|
|
//Um namen der Folge für jede Staffel zu bekommen
|
|
|
|
|
for (int staffel = 1; staffel <= maxStaffel; ++staffel) {
|
|
|
|
|
Reply tmpReply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel));
|
|
|
|
|
Reply tmpReply = pageManager.getServerRequest( "https://" + 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;
|
|
|
|
@ -1073,7 +1130,8 @@ int ProgramManager::infoModus(Settings *settings)
|
|
|
|
|
int ProgramManager::newsModus(Settings *settings)
|
|
|
|
|
{
|
|
|
|
|
size_t pos = 0;
|
|
|
|
|
std::string html = pageManager.getServerRequest("https://serienstream.sx/neue-episoden").html;
|
|
|
|
|
PAGE page("", "");
|
|
|
|
|
std::string html = pageManager.getServerRequest("https://" + page.url +"/neue-episoden").html;
|
|
|
|
|
if(html == "-1") {
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl;
|
|
|
|
@ -1602,7 +1660,7 @@ int ProgramManager::listDir(std::string &list,std::string path, int maxDepth, bo
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ProgramManager::convertLink(std::string redirectLink, AccountManager * accountManager,
|
|
|
|
|
int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountManager * accountManager,
|
|
|
|
|
Settings * settings, int Staffel, int Folge, std::string allLinks)
|
|
|
|
|
{
|
|
|
|
|
std::string folgenID = std::string((Staffel == -1 || Folge == -1 ) ? "" : "S" + std::string( (Staffel < 10) ? "0" : "" ) + std::to_string(Staffel)
|
|
|
|
@ -1635,7 +1693,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= 3; ++i) {
|
|
|
|
|
std::string newUrl = pageManager.getUrlAfterRedirect("https://serienstream.sx" + redirectLink);
|
|
|
|
|
std::string newUrl = pageManager.getUrlAfterRedirect("https://" + page.url + redirectLink);
|
|
|
|
|
//wenn function fehl schlug beende das Programm
|
|
|
|
|
if (newUrl == "-1") {
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
@ -1643,22 +1701,22 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
|
|
|
|
|
return 102;
|
|
|
|
|
|
|
|
|
|
// wenn nach der Umwandlung immern och ein redirect vorhanden ist, also wenn z.B.: account gewechselt werden muss
|
|
|
|
|
} else if(newUrl.find("/serienstream.sx/redirect/") != std::string::npos ) {
|
|
|
|
|
} else if(newUrl.find("/" + page.url + "/redirect/") != std::string::npos ) {
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
|
std::cout << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl;
|
|
|
|
|
if(pageManager.login(accountManager->getNextAccount()) != 0) {
|
|
|
|
|
if(pageManager.login(page, accountManager->getNextAccount()) != 0) {
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": login f() failed." << std::endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
//wenn nach der Umwandlung https://serienstream.sx/ vorhanden ist, die ist wenn der Link Ungültig war:
|
|
|
|
|
} else if (newUrl == "https://serienstream.sx/") {
|
|
|
|
|
std::cout << " => " << red << replace(folgenID, "E", " E") << ( (folgenID == "") ? "" : ": " ) << "Ungültige Url: 'https://serienstream.sx" << redirectLink << "'"
|
|
|
|
|
//wenn nach der Umwandlung https://seriens tream.sx/ vorhanden ist, die ist wenn der Link Ungültig war:
|
|
|
|
|
} else if (newUrl == "https://" + page.url + "/") {
|
|
|
|
|
std::cout << " => " << red << replace(folgenID, "E", " E") << ( (folgenID == "") ? "" : ": " ) << "Ungültige Url: 'https://" + page.url << redirectLink << "'"
|
|
|
|
|
<< ((settings->colorless) ? "" : "\033[0m") << std::endl;
|
|
|
|
|
if(settings->outputFilePaths.size() != 0)
|
|
|
|
|
if(pageManager.writeToFile(settings->outputFilePaths, replace(folgenID, "E", " E") + ( (folgenID == "") ? "" : ": " ) + "Ungültige Url: https://serienstream.sx" + redirectLink) != 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;
|
|
|
|
|
return 108;
|
|
|
|
@ -1684,7 +1742,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//nach 3temn Versuch gib error aus:
|
|
|
|
|
std::cout << " => " << replace(folgenID, "E", " E") << ( (folgenID == "") ? "" : ": " ) << red << "https://serienstream.sx" << redirectLink << ((settings->colorless) ? "" : "\033[0m") << std::endl;
|
|
|
|
|
std::cout << " => " << replace(folgenID, "E", " E") << ( (folgenID == "") ? "" : ": " ) << red << "https://" + page.url << redirectLink << ((settings->colorless) ? "" : "\033[0m") << std::endl;
|
|
|
|
|
if(settings->outputFilePaths.size() != 0) {
|
|
|
|
|
if(pageManager.writeToFile(settings->outputFilePaths, replace(folgenID, "E", " E") + ( (folgenID == "") ? "" : ": " ) + redirectLink) != 0) {
|
|
|
|
|
if(settings->debugMode)
|
|
|
|
|