forked from markus/S_New4
vKa...again with new lib, but deactivate ssl check? idk if better, but
laos no page found check
This commit is contained in:
parent
aa1d8d502a
commit
5ae309f86f
@ -5,8 +5,8 @@ CONFIG += -static -libstdc++ -static-libgcc #-static
|
|||||||
unix: LIBS += -lcurl
|
unix: LIBS += -lcurl
|
||||||
|
|
||||||
#Windows
|
#Windows
|
||||||
#win32: LIBS += -L$${_PRO_FILE_PWD_}\..\lib\ -lcurl # 7.82.0
|
win32: LIBS += -L$${_PRO_FILE_PWD_}\..\lib\ -lcurl # 7.82.0
|
||||||
win32: LIBS += -L$${_PRO_FILE_PWD_}\..\alt\ -lcurl # 7.64.1
|
#win32: LIBS += -L$${_PRO_FILE_PWD_}\..\alt\ -lcurl # 7.64.1
|
||||||
|
|
||||||
|
|
||||||
CONFIG += c++17 console
|
CONFIG += c++17 console
|
||||||
|
@ -72,14 +72,12 @@ int AccountManager::writeDefault(std::string path)
|
|||||||
STO,
|
STO,
|
||||||
ANICLOUD,
|
ANICLOUD,
|
||||||
STOIP,
|
STOIP,
|
||||||
SERIENSTREAMSX,
|
|
||||||
SERIENCAM,
|
SERIENCAM,
|
||||||
SERIENSTREAMTO
|
SERIENSTREAMTO
|
||||||
};
|
};
|
||||||
|
|
||||||
if( pageInUse.url == pagesALL[STO].url
|
if( pageInUse.url == pagesALL[STO].url
|
||||||
|| pageInUse.url == pagesALL[STOIP].url
|
|| pageInUse.url == pagesALL[STOIP].url
|
||||||
|| pageInUse.url == pagesALL[SERIENSTREAMSX].url
|
|
||||||
|| pageInUse.url == pagesALL[SERIENCAM].url
|
|| pageInUse.url == pagesALL[SERIENCAM].url
|
||||||
|| pageInUse.url == pagesALL[SERIENSTREAMTO].url)
|
|| pageInUse.url == pagesALL[SERIENSTREAMTO].url)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "programManager.h"
|
#include "programManager.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
ProgramManager mainProgram;
|
ProgramManager mainProgram;
|
||||||
|
@ -112,6 +112,14 @@ Reply PageManager::getServerRequest(std::string protocol, std::string Url, bool
|
|||||||
|
|
||||||
//curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); // html errors to errorcode res
|
//curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); // html errors to errorcode res
|
||||||
//curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false); // Progressausgabe aktivieren
|
//curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false); // Progressausgabe aktivieren
|
||||||
|
|
||||||
|
#ifdef noSLLCheck
|
||||||
|
// TODO: SET IT BACK
|
||||||
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, Url.c_str()); //Url für Curl
|
curl_easy_setopt(curl, CURLOPT_URL, Url.c_str()); //Url für Curl
|
||||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); //follows redirection
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); //follows redirection
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); // Funktion zum Speichern des outputs in einem string
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); // Funktion zum Speichern des outputs in einem string
|
||||||
@ -204,6 +212,13 @@ int PageManager::downLoadToFile(std::string filePath, std::string url)
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef noSLLCheck
|
||||||
|
// TODO: SET IT BACK
|
||||||
|
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
|
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* set URL to get here */
|
/* set URL to get here */
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str());
|
curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str());
|
||||||
|
|
||||||
@ -301,7 +316,7 @@ Reply PageManager::getUrlAfterRedirect( std::string p,std::string Url, std::stri
|
|||||||
return getServerRequest(p , 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)
|
||||||
{
|
{
|
||||||
if(pages.size() < 1) {
|
if(pages.size() < 1) {
|
||||||
std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl;
|
std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl;
|
||||||
@ -317,9 +332,9 @@ checkNameRply PageManager::checkName(std::vector<PAGE> pages, std::string Name,
|
|||||||
PAGE Page;
|
PAGE Page;
|
||||||
|
|
||||||
//für jede Seite
|
//für jede Seite
|
||||||
for ( const auto &p : pages ) {
|
for ( unsigned i = 0; i < pages.size(); i++ ) {
|
||||||
|
|
||||||
std::string html = getServerRequest(p.protocol, p.url + p.UrlDir + name).html;
|
std::string html = getServerRequest(pages.at(i).protocol, pages.at(i).url + pages.at(i).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;
|
||||||
|
|
||||||
@ -328,14 +343,17 @@ checkNameRply PageManager::checkName(std::vector<PAGE> pages, std::string Name,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if (html == "-1" || html == "") {
|
} else if (html == "-1" || html == "") {
|
||||||
std::cout << "\33[2K\r" <<" => WARNUNG: Das laden der Seite : '" << p.url << "' ist fehlgeschlagen" << std::endl;
|
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;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
count ++;
|
count ++;
|
||||||
pagesonExist += p.url + " ";
|
pagesonExist += pages.at(i).url + " ";
|
||||||
Page = p;
|
Page = pages.at(i);
|
||||||
|
|
||||||
if(useFirstPage) {
|
if(useFirstPage) {
|
||||||
if(debugMode)
|
if(debugMode)
|
||||||
@ -352,8 +370,14 @@ 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!!!! same option -> führe suche funktion aus
|
return checkNameRply("", PAGE(), checkNameRply::MULTIPLE_OPTIONS); //MULTIPLE OPTIONS FOUND!!!! same option -> führe suche funktion aus
|
||||||
} else {
|
|
||||||
|
} else if( count == 0 && pages.size() == 0) {
|
||||||
|
//keine suche wenn es keine funktionierende seite gibt
|
||||||
|
return checkNameRply("", PAGE(), checkNameRply::NO_WORKING_PAGE);
|
||||||
|
|
||||||
|
} // führe suche aus...
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "./../include/curl/curl.h"
|
#include "./../include/curl/curl.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
//----------------------?????????????????
|
||||||
|
#define noSLLCheck
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include "curl/curl.h"
|
#include "curl/curl.h"
|
||||||
#endif
|
#endif
|
||||||
@ -29,7 +33,7 @@ struct Reply {
|
|||||||
struct checkNameRply {
|
struct checkNameRply {
|
||||||
std::string name;
|
std::string name;
|
||||||
PAGE pageInUse;
|
PAGE pageInUse;
|
||||||
enum STATUS { SUCCESS, FAILED, NOTHING_FOUND } 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 )
|
checkNameRply(const std::string &name, const PAGE &p, const checkNameRply::STATUS &s )
|
||||||
: name(name), pageInUse(p), status(s) {}
|
: name(name), pageInUse(p), status(s) {}
|
||||||
@ -52,7 +56,7 @@ public:
|
|||||||
|
|
||||||
int login(PAGE page, Account account, std::string cookieFilePath);
|
int login(PAGE page, Account account, std::string cookieFilePath);
|
||||||
Reply getUrlAfterRedirect(std::string p, 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);
|
||||||
std::string getLinkAfterHosterBasedOperation(std::string url);
|
std::string getLinkAfterHosterBasedOperation(std::string url);
|
||||||
|
@ -217,7 +217,7 @@ int loadDefaulOptions(Settings &settings)
|
|||||||
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 << "# Kombinierbar mit -f - Verwende erste Seite" << std::endl;
|
||||||
ofs << "# Unterstützte Seiten:" << 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 << "# 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=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;
|
||||||
@ -1837,6 +1837,11 @@ int setUpInternetPages(Settings &settings, std::string optarg)
|
|||||||
while(std::getline(ss, value, ',')) {
|
while(std::getline(ss, value, ',')) {
|
||||||
if(value == "")
|
if(value == "")
|
||||||
continue;
|
continue;
|
||||||
|
else if(value == "all") {
|
||||||
|
for( const auto & internetSeite : settings.pagesALL )
|
||||||
|
settings.pagesInUse.push_back(internetSeite);
|
||||||
|
break;
|
||||||
|
}
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for( const auto & internetSeite : settings.pagesALL ) {
|
for( const auto & internetSeite : settings.pagesALL ) {
|
||||||
if( value == internetSeite.url ) {
|
if( value == internetSeite.url ) {
|
||||||
|
@ -73,10 +73,10 @@ struct Settings {
|
|||||||
_stoIP = PAGE( "", "190.115.18.20", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
_stoIP = PAGE( "", "190.115.18.20", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||||
serienstreamto = PAGE("https://", "serienstream.to", "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/"),
|
seriencam = PAGE("https://", "serien.cam", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||||
_serienstreamsx = PAGE( "https://", "serienstream.sx", "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/");
|
_anicio = PAGE( "https://" , "anicloud.io", "Animes", "/animes-alphabet", "/anime/stream/");
|
||||||
const PAGE pagesALL[6] = { _sto, _anicio, _stoIP, _serienstreamsx, seriencam, serienstreamto };
|
const PAGE pagesALL[5] = { _sto, _anicio, _stoIP, /*_serienstreamsx,*/ seriencam, serienstreamto };
|
||||||
|
|
||||||
std::vector<PAGE> pagesInUse; // Priority sorted
|
std::vector<PAGE> pagesInUse; // Priority sorted
|
||||||
bool useFirstPage = false;
|
bool useFirstPage = false;
|
||||||
|
@ -364,13 +364,19 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
|
|||||||
auto ret = pageManager.checkName( pages /*settings->pages dann glaub
|
auto ret = pageManager.checkName( pages /*settings->pages dann glaub
|
||||||
ich immer fehler, wenn serie auf 2 seiten excistiert*/,
|
ich immer fehler, wenn serie auf 2 seiten excistiert*/,
|
||||||
finds, settings->useFirstPage);
|
finds, settings->useFirstPage);
|
||||||
if(ret.status == ret.FAILED)
|
if(ret.status == ret.FAILED || ret.status == ret.MULTIPLE_OPTIONS)
|
||||||
return 23;
|
return 23;
|
||||||
else if( ret.status == ret.NOTHING_FOUND ) {
|
else if( ret.status == ret.NOTHING_FOUND ) {
|
||||||
std::cout << " => Error: Konnte die von der Suche vorgeschlagene Serie nicht finden." << std::endl;
|
std::cout << " => Error: Konnte die von der Suche vorgeschlagene Serie nicht finden." << std::endl;
|
||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Extracted Name from searchModus is invalid." << std::endl;
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Extracted Name from searchModus is invalid." << std::endl;
|
||||||
return 47;
|
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;
|
||||||
|
return 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//speichere neuen Namen in übergebenen ref var
|
//speichere neuen Namen in übergebenen ref var
|
||||||
newNameAndPage.name = ret.name;
|
newNameAndPage.name = ret.name;
|
||||||
@ -569,7 +575,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
|||||||
|
|
||||||
if(retVal.status == retVal.FAILED)
|
if(retVal.status == retVal.FAILED)
|
||||||
return 67;
|
return 67;
|
||||||
else if(retVal.status == retVal.NOTHING_FOUND) {
|
else if(retVal.status == retVal.NOTHING_FOUND || retVal.status == retVal.MULTIPLE_OPTIONS) {
|
||||||
//Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch && Wenn nur 1ne dacnn frag ob es diese ist.
|
//Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch && Wenn nur 1ne dacnn frag ob es diese ist.
|
||||||
int res = 0;
|
int res = 0;
|
||||||
if( ( res = sucheNach_1_Serien(settings, pageManager, retVal) ) != 0) {
|
if( ( res = sucheNach_1_Serien(settings, pageManager, retVal) ) != 0) {
|
||||||
@ -577,6 +583,11 @@ int ProgramManager::defaultModus(Settings *settings)
|
|||||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien failed or found more options." << std::endl;
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien failed or found more options." << std::endl;
|
||||||
return (res == -10101) ? 0 : 202;
|
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;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string nameInUrl = retVal.name;
|
std::string nameInUrl = retVal.name;
|
||||||
@ -1041,7 +1052,7 @@ int ProgramManager::infoModus(Settings *settings)
|
|||||||
auto retV = pageManager.checkName(settings->pagesInUse, 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 || retV.status == retV.MULTIPLE_OPTIONS ) {
|
||||||
//Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch.
|
//Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch.
|
||||||
int res = 0;
|
int res = 0;
|
||||||
if( ( res = sucheNach_1_Serien(settings, pageManager, retV) ) != 0) {
|
if( ( res = sucheNach_1_Serien(settings, pageManager, retV) ) != 0) {
|
||||||
@ -1049,6 +1060,11 @@ int ProgramManager::infoModus(Settings *settings)
|
|||||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien function failed." << std::endl;
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien function failed." << std::endl;
|
||||||
return (res == -10101) ? 0 : 28;
|
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;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
std::string nameInUrl = retV.name;
|
std::string nameInUrl = retV.name;
|
||||||
PAGE page = retV.pageInUse;
|
PAGE page = retV.pageInUse;
|
||||||
|
Loading…
Reference in New Issue
Block a user