forked from markus/S_New4
windows
This commit is contained in:
parent
afa1d76ea5
commit
a33e54d522
BIN
src/debug/S_New4.exe
Normal file
BIN
src/debug/S_New4.exe
Normal file
Binary file not shown.
@ -234,8 +234,8 @@ int PageManager::downLoadToFile(std::string filePath, std::string url)
|
||||
//Sock5Proxy für Curl
|
||||
if(sock5Proxy != "")
|
||||
curl_easy_setopt(curl_handle, CURLOPT_PROXY, sock5Proxy.c_str() ); //Sock5Proxy für Curl
|
||||
else if(debugMode)
|
||||
std::cout << "\33[2K\r => INFO: Es wird kein Proxy verwendet." << std::endl;
|
||||
if(debugMode)
|
||||
std::cout << "\33[2K\r => INFO: Proxy:'" << sock5Proxy << "'" << std::endl;
|
||||
|
||||
//User Agent
|
||||
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0");
|
||||
@ -285,10 +285,6 @@ int PageManager::login(PAGE page, Account account, std::string 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;
|
||||
|
||||
auto fs = std::vector<std::string>();
|
||||
fs.push_back("/home/markus/aaaaaaaaaaaaaaaaaaaaaaaa.html");
|
||||
this->writeToFile(fs, html);
|
||||
|
||||
if(html == "" )
|
||||
return 0;
|
||||
else if (html.find("Das Feld Email muss eine gültige E-Mail-Adresse enthalten.") != std::string::npos)
|
||||
@ -316,7 +312,7 @@ Reply PageManager::getUrlAfterRedirect( std::string p,std::string Url, std::stri
|
||||
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, std::vector<std::string> &outPutFilePaths)
|
||||
{
|
||||
if(pages.size() < 1) {
|
||||
std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl;
|
||||
@ -344,11 +340,15 @@ checkNameRply PageManager::checkName(std::vector<PAGE> &pages, std::string Name,
|
||||
|
||||
} else if (html == "-1" || html == "") {
|
||||
std::cout << "\33[2K\r" <<" => WARNUNG: Das laden der Seite : '" << pages.at(i).url << "' ist fehlgeschlagen" << std::endl;
|
||||
|
||||
pages.erase(pages.begin() + i);
|
||||
i--;
|
||||
continue;
|
||||
|
||||
} else if( html.find("<!DOCTYPE html><html><head><title>DDOS-GUARD</title>") != std::string::npos ) {
|
||||
std::cout << "\33[2K\r" <<" => WARNUNG: Die Seite : '" << pages.at(i).url << "' benötigt ein DDOS-GUARD hCaptcha!" << std::endl;
|
||||
pages.erase(pages.begin() + i);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
count ++;
|
||||
@ -357,7 +357,7 @@ checkNameRply PageManager::checkName(std::vector<PAGE> &pages, std::string Name,
|
||||
|
||||
if(useFirstPage) {
|
||||
if(debugMode)
|
||||
std::cerr << "Nimm gleiche diese Seite, da useFirstPage auf true ist" << std::endl;
|
||||
std::cerr << "Nimm gleiche diese Seite, da useFirstPage auf true ist: " << pages.at(i).url << std::endl;
|
||||
break; // nimm gleich das erste
|
||||
}
|
||||
}
|
||||
@ -365,7 +365,10 @@ checkNameRply PageManager::checkName(std::vector<PAGE> &pages, std::string Name,
|
||||
|
||||
//
|
||||
if( count == 1 ) {
|
||||
std::cout << "\33[2K\r > Name: " << name << std::endl;
|
||||
//std::cout << "\33[2K\r > Name: " << name << std::endl;
|
||||
for( auto &path : outPutFilePaths)
|
||||
path = replace(path, "%URLNAME%", name);
|
||||
|
||||
return checkNameRply(name, Page, checkNameRply::SUCCESS);;
|
||||
} else if ( count > 1) {
|
||||
std::cout << "\33[2K\r => Die Serie existiert auf mehreren Seiten " << name << ": '" << pagesonExist << "'" << std::endl;
|
||||
|
@ -33,7 +33,9 @@ struct Reply {
|
||||
struct checkNameRply {
|
||||
std::string name;
|
||||
PAGE pageInUse;
|
||||
enum STATUS { SUCCESS, FAILED, NOTHING_FOUND, MULTIPLE_OPTIONS, NO_WORKING_PAGE } status;
|
||||
enum STATUS { SUCCESS, FAILED, NOTHING_FOUND, MULTIPLE_OPTIONS, NO_WORKING_PAGE }
|
||||
status;
|
||||
|
||||
|
||||
checkNameRply(const std::string &name, const PAGE &p, const checkNameRply::STATUS &s )
|
||||
: name(name), pageInUse(p), status(s) {}
|
||||
@ -56,7 +58,7 @@ public:
|
||||
|
||||
int login(PAGE page, Account account, 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::vector<std::string> &outPutFilePaths /*for replacement*/);
|
||||
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 getLinkAfterHosterBasedOperation(std::string url);
|
||||
|
@ -218,7 +218,7 @@ int loadDefaulOptions(Settings &settings)
|
||||
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, serien.cam, all" << std::endl;
|
||||
ofs << "Internetseiten=anicloud.io,serienstream.sx" << std::endl << std::endl;
|
||||
ofs << "Internetseiten=AniWorld.to,serienstream.to" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -f, --use-first:" << std::endl;
|
||||
ofs << "# -> Benutze sofort die erste Seite, wenn die Serie dort existiert." << std::endl;
|
||||
@ -685,7 +685,7 @@ void unterOption_default_help(std::string programName)
|
||||
<< " nach Serien gesucht werden soll. (Nur Seiten aus Default Wert möglich)" << std::endl
|
||||
<< " Die Seiten Kommagetrennt nach Priorität angeben. (Höchste am Anfang)" << std::endl
|
||||
<< " Gut Kombinierbar mit --use-first-page kombenierbar!" << std::endl
|
||||
<< " Standart: anicloud.io,serienstream.sx" << std::endl
|
||||
<< " Standart: AniWorld.to,serienstream.to" << std::endl
|
||||
<< " -f, --use-first-page" << std::endl
|
||||
<< " Mit dieser Option kann man festlegen, dass direkt die erste Seite," << std::endl
|
||||
<< " auf der die Serie vorhanden ist, verwendet wird. ( Reihenfolge der" << std::endl
|
||||
@ -1045,7 +1045,7 @@ void unterOption_search_help(std::string programName)
|
||||
<< " nach Serien gesucht werden soll. (Nur Seiten aus Default Wert möglich)" << std::endl
|
||||
<< " Die Seiten Kommagetrennt nach Priorität angeben. (Höchste am Anfang)" << std::endl
|
||||
<< " Das Aktualisieren der Liste kann damit nicht beeinflusst werden." << std::endl
|
||||
<< " Standart: anicloud.io,serienstream.sx" << std::endl << std::endl;
|
||||
<< " Standart: AniWorld.to,serienstream.to" << std::endl << std::endl;
|
||||
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
@ -1079,18 +1079,19 @@ 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'},
|
||||
|
||||
{"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, 's'},
|
||||
{"skip-episoden-names", no_argument, nullptr, 'l'},
|
||||
|
||||
{nullptr, no_argument, nullptr, 0}
|
||||
|
||||
};
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:o:i:fhcds", long_opts, nullptr) ) != -1 ) {
|
||||
while( ( c = getopt_long (argc, argv, "p:o:i:l:fhcds", long_opts, nullptr) ) != -1 ) {
|
||||
switch(c) {
|
||||
case 'p':
|
||||
if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
|
||||
@ -1126,6 +1127,13 @@ int unterOption_info(Settings *settings, int argc, char **argv)
|
||||
if(settings->debugMode)
|
||||
std::cout << "Debug Modus: true" << std::endl;
|
||||
break;
|
||||
case 'l':
|
||||
if(!optarg)
|
||||
break;
|
||||
settings->downloadCoverPfad = optarg;
|
||||
if(settings->debugMode)
|
||||
std::cout << "downloadCoverPfad: " << optarg << std::endl;
|
||||
break;
|
||||
case 's':
|
||||
settings->skipEpisodenNameOutput = true;
|
||||
if(settings->debugMode)
|
||||
@ -1168,7 +1176,7 @@ void unterOption_info_help(std::string programName)
|
||||
<< " nach Serien gesucht werden soll. (Nur Seiten aus Default Wert möglich)" << std::endl
|
||||
<< " Die Seiten Kommagetrennt nach Priorität angeben. (Höchste am Anfang)" << std::endl
|
||||
<< " Gut Kombinierbar mit --use-first-page kombenierbar!" << std::endl
|
||||
<< " Standart: anicloud.io,serienstream.sx" << std::endl
|
||||
<< " Standart: AniWorld.to,serienstream.to" << std::endl
|
||||
<< " -f, --use-first-page" << std::endl
|
||||
<< " Mit dieser Option kann man festlegen, dass direkt die erste Seite," << std::endl
|
||||
<< " auf der die Serie vorhanden ist, verwendet wird. ( Reihenfolge der" << std::endl
|
||||
@ -1194,6 +1202,9 @@ void unterOption_info_help(std::string programName)
|
||||
<< " -o [Pfad], --output-file [Pfad]" << std::endl
|
||||
<< " Mit diere Option kann man eine (nichtvorhandene) Text-Datei" << std::endl
|
||||
<< " angeben, inwelche die Infos geschrieben werden." << std::endl
|
||||
<< " -l [Pfad], --lade-bild-herunter [Pfad]" << std::endl
|
||||
<< " Mit diere Option kann man einen Pfad zu einer Datei" << std::endl
|
||||
<< " angeben, inwelche das Cover herunter geladen wird." << std::endl
|
||||
<< " -h, --help" << std::endl
|
||||
<< " Mit dieser Option wird dieses Helpmenue ausgegeben." << std::endl;
|
||||
}
|
||||
@ -1481,7 +1492,7 @@ void unterOption_news_help(std::string programName)
|
||||
<< " nach Serien gesucht werden soll. (Nur Seiten aus Default Wert möglich)" << std::endl
|
||||
<< " Die Seiten Kommagetrennt nach Priorität angeben. (Höchste am Anfang)" << std::endl
|
||||
<< " Gut Kombinierbar mit --use-first-page kombenierbar!" << std::endl
|
||||
<< " Standart: anicloud.io,serienstream.sx" << std::endl
|
||||
<< " Standart: AniWorld.to,serienstream.to" << std::endl
|
||||
<< " -f, --use-first-page" << std::endl
|
||||
<< " Mit dieser Option kann man festlegen, dass direkt die erste Seite," << std::endl
|
||||
<< " auf der die Serie vorhanden ist, verwendet wird. ( Reihenfolge der" << std::endl
|
||||
@ -1843,14 +1854,15 @@ int setUpInternetPages(Settings &settings, std::string optarg)
|
||||
while(std::getline(ss, value, ',')) {
|
||||
if(value == "")
|
||||
continue;
|
||||
else if(value == "all") {
|
||||
value = PageManager::upper_string(value);
|
||||
if(value == "ALL") {
|
||||
for( const auto & internetSeite : settings.pagesALL )
|
||||
settings.pagesInUse.push_back(internetSeite);
|
||||
break;
|
||||
}
|
||||
bool found = false;
|
||||
for( const auto & internetSeite : settings.pagesALL ) {
|
||||
if( value == internetSeite.url ) {
|
||||
if( value == PageManager::upper_string( internetSeite.url ) ) {
|
||||
settings.pagesInUse.push_back( internetSeite );
|
||||
if(settings.debugMode)
|
||||
std::cout << " > : Internetseiten pusback: " << internetSeite.url << std::endl;
|
||||
|
@ -70,12 +70,11 @@ struct Settings {
|
||||
|
||||
const std::string programName = "S_New4";
|
||||
const PAGE _sto = PAGE( "https://", "s.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
_stoIP = PAGE( "", "190.115.18.20", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
_stoIP = PAGE( "http://", "190.115.18.20", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
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://" , "AniWorld.to", "Animes", "/animes-alphabet", "/anime/stream/");
|
||||
_anicio = PAGE( "https://" , "aniworld.to", "Animes", "/animes-alphabet", "/anime/stream/");
|
||||
const PAGE pagesALL[5] = { _sto, _anicio, _stoIP, /*_serienstreamsx,*/ seriencam, serienstreamto };
|
||||
|
||||
std::vector<PAGE> pagesInUse; // Priority sorted
|
||||
@ -146,7 +145,8 @@ struct Settings {
|
||||
defaultFileVersion= DEFAULT_FILE_VERSION,
|
||||
default_checkPath = "",
|
||||
default_Searchmuster = "S%Staffel%E%Folge%",
|
||||
argv0;
|
||||
argv0,
|
||||
downloadCoverPfad;
|
||||
|
||||
std::vector<std::string> outputFilePaths;
|
||||
|
||||
|
@ -26,7 +26,6 @@ int ProgramManager::start(Settings *settings)
|
||||
return 174;
|
||||
}
|
||||
|
||||
|
||||
//Überprüfe letzte Update suche
|
||||
if(settings->modus != Modus::UPDATE_MODUS )
|
||||
if( checkLastProgrammUpdate(settings) )
|
||||
@ -363,7 +362,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
|
||||
|
||||
auto ret = pageManager.checkName( pages /*settings->pages dann glaub
|
||||
ich immer fehler, wenn serie auf 2 seiten excistiert*/,
|
||||
finds, settings->useFirstPage);
|
||||
finds, settings->useFirstPage, settings->outputFilePaths);
|
||||
if(ret.status == ret.FAILED || ret.status == ret.MULTIPLE_OPTIONS)
|
||||
return 23;
|
||||
else if( ret.status == ret.NOTHING_FOUND ) {
|
||||
@ -571,7 +570,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
||||
|
||||
|
||||
//Führe Function aus, die überprüft ob die serie existiert (einmal???)
|
||||
auto retVal = pageManager.checkName(settings->pagesInUse, settings->name, settings->useFirstPage);
|
||||
auto retVal = pageManager.checkName(settings->pagesInUse, settings->name, settings->useFirstPage, settings->outputFilePaths);
|
||||
|
||||
if(retVal.status == retVal.FAILED)
|
||||
return 67;
|
||||
@ -594,7 +593,6 @@ int ProgramManager::defaultModus(Settings *settings)
|
||||
PAGE page = retVal.pageInUse;
|
||||
AccountManager accountManager(settings->accountFilePath, settings->accountNumberPath, page, settings->pagesALL);
|
||||
|
||||
|
||||
/* Wenn multihtreading seaktiviert ist, normal login sonst bereite threads vor
|
||||
if(settings->maxThreads == 0) {
|
||||
// melde bei seriens tream.sx an und speicher cookies.
|
||||
@ -622,7 +620,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
||||
|
||||
//Write Name to File if -o is set und kein TXT-FILE angegeben wird
|
||||
if(settings->outputFilePaths.size() != 0 && !fileExists( settings->default_checkPath ))
|
||||
if(pageManager.writeToFile(settings->outputFilePaths, "Name: " + settings->name) != 0) {
|
||||
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;
|
||||
return 31;
|
||||
@ -1049,7 +1047,7 @@ int ProgramManager::infoModus(Settings *settings)
|
||||
}
|
||||
|
||||
//Führe Function aus, die überprüft ob die serie existiert
|
||||
auto retV = pageManager.checkName(settings->pagesInUse, settings->name, settings->useFirstPage);
|
||||
auto retV = pageManager.checkName(settings->pagesInUse, settings->name, settings->useFirstPage, settings->outputFilePaths);
|
||||
if(retV.status == retV.FAILED)
|
||||
return 145;
|
||||
else if(retV.status == retV.NOTHING_FOUND || retV.status == retV.MULTIPLE_OPTIONS ) {
|
||||
@ -1069,6 +1067,7 @@ int ProgramManager::infoModus(Settings *settings)
|
||||
std::string nameInUrl = retV.name;
|
||||
PAGE page = retV.pageInUse;
|
||||
|
||||
std::cout << "Serie: " + settings->name + " (" + nameInUrl + ")" << std::endl;
|
||||
|
||||
//write Name to file
|
||||
if(pageManager.writeToFile(settings->outputFilePaths, "\n\nSerie: " + settings->name + " (" + nameInUrl + ")") != 0)
|
||||
@ -1325,6 +1324,14 @@ int ProgramManager::infoModus(Settings *settings)
|
||||
return 130;
|
||||
}
|
||||
|
||||
//DOWNLOADE DATEI....
|
||||
if(settings->downloadCoverPfad != "") {
|
||||
if( pageManager.downLoadToFile( settings->downloadCoverPfad, ((coverLink.find("http") == std::string::npos) ? (page.protocol + page.url) : "") + coverLink ) != 0) {
|
||||
std::cout << " => Error: Konnte Bild nicht herunterladen." << std::endl;
|
||||
return 89;
|
||||
}
|
||||
}
|
||||
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": success exit." << std::endl;
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user