forked from markus/S_New4
ok
This commit is contained in:
parent
ce3f2adbad
commit
b2f7ee4380
@ -1,14 +1,18 @@
|
||||
#include "pageManager.h"
|
||||
|
||||
PageManager::PageManager(std::string sock5ProxyOnlyAddress, std::string cookieFilePath)
|
||||
PageManager::PageManager(std::string sock5ProxyOnlyAddress)
|
||||
: sock5Proxy("socks5://" + sock5ProxyOnlyAddress)
|
||||
{
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
if(false)
|
||||
std::cout << "PageManager()" << std::endl;
|
||||
}
|
||||
|
||||
PageManager::~PageManager()
|
||||
{
|
||||
curl_global_cleanup();
|
||||
if(false)
|
||||
std::cout << "~PageManager()" << std::endl;
|
||||
}
|
||||
|
||||
void PageManager::setProxy(std::string ip, int port)
|
||||
|
@ -37,7 +37,7 @@ struct checkNameRply {
|
||||
class PageManager
|
||||
{
|
||||
public:
|
||||
PageManager(std::string sock5ProxyOnlyAddress = "127.0.0.1:9150", std::string cookieFilePath = "/tmp/S_New4_cookies");
|
||||
PageManager(std::string sock5ProxyOnlyAddress = "127.0.0.1:9150");
|
||||
~PageManager();
|
||||
|
||||
void setProxy(std::string ip, int port);
|
||||
|
@ -192,13 +192,22 @@ int loadDefaulOptions(Settings &settings)
|
||||
ofs << "#OutputFile=/tmp/b" << std::endl;
|
||||
ofs << "# -> Log-to-LogFile: Speichere Ausgabe im LogFile - LogFile u.a. beim" << std::endl;
|
||||
ofs << "# JD2-Renamer Skript nötig. Auch anderer Pfad möglich." << std::endl;
|
||||
ofs << "OutputFile=" << settings.logFilePath<< std::endl << std::endl;
|
||||
ofs << "OutputFile=" << settings.logFilePath << std::endl << 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 << "# (anicloud.ion/serienstream.sx) - Der Priorität nach angeben!" << std::endl;
|
||||
ofs << "Internetseiten=anicloud.io,serienstream.sx" << 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;
|
||||
ofs << "# Wenn deaktiviert, manuelle auswahl der Seiten nötig!" << std::endl;
|
||||
ofs << "#UseFirstPage=false" << std::endl << std::endl;
|
||||
|
||||
ofs << "#" << std::endl << "# -> Einstellungen für default Modus:" << std::endl << "#" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -g, --genaue-hoster:" << std::endl;
|
||||
ofs << "default_GenaueHoster=UpStream,Vidoza,Vivo,GoUnlimited" << std::endl << std::endl;
|
||||
ofs << "default_GenaueHoster=UpStream,Vidoza,GoUnlimited" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -l, --languages:" << std::endl;
|
||||
ofs << "#default_Sprachen=GerDub,GerSub,Eng" << std::endl << std::endl;
|
||||
@ -341,6 +350,22 @@ int loadDefaulOptions(Settings &settings)
|
||||
if(settings.debugMode)
|
||||
std::cout << " > Defaults: search_UpdateWarnungNachTagen: " << settings.updateWarningDays << std::endl;
|
||||
|
||||
} else if (what == "Internetseiten") {
|
||||
if(setUpInternetPages(settings, data) != 0)
|
||||
return 1233;
|
||||
|
||||
} else if (what == "UseFirstPage") {
|
||||
if(data == "true")
|
||||
settings.useFirstPage=true;
|
||||
else if (data == "false")
|
||||
settings.useFirstPage=false;
|
||||
else {
|
||||
std::cout << " => Error_Defaults: sUseFirstPage: Ungültiger Wert für 'true/false': " << data << std::endl;
|
||||
return 245;
|
||||
}
|
||||
if(settings.debugMode)
|
||||
std::cout << " > Defaults: UseFirstPage: " << settings.useFirstPage << std::endl;
|
||||
|
||||
} else if (what == "test") {
|
||||
//test
|
||||
|
||||
@ -413,16 +438,19 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
|
||||
{"check-max-dirs", required_argument, nullptr, 'D'},
|
||||
|
||||
{"threads", required_argument, nullptr, 't'},
|
||||
{"internet-pages", required_argument, nullptr, 'i'},
|
||||
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"colorless", no_argument, nullptr, 'c'},
|
||||
{"debug-mode", no_argument, nullptr, 'd'},
|
||||
{"use-first-page", no_argument, nullptr, 'f'},
|
||||
|
||||
{nullptr, no_argument, nullptr, 0}
|
||||
|
||||
};
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:g:l:o:e:E:s:S:C:m:D:t:hcd", long_opts, nullptr) ) != -1 ) {
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:g:l:o:e:E:s:S:C:m:D:t:i:fhcd", long_opts, nullptr) ) != -1 ) {
|
||||
switch(c) {
|
||||
case 'p':
|
||||
if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
|
||||
@ -528,6 +556,18 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
|
||||
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
if(!optarg)
|
||||
break;
|
||||
if(setUpInternetPages(*settings, optarg) != 0)
|
||||
return 4356;
|
||||
|
||||
break;
|
||||
case 'f':
|
||||
settings->useFirstPage = true;
|
||||
if(settings->debugMode)
|
||||
std::cout << "useFirstPage: " << settings->useFirstPage << std::endl;
|
||||
break;
|
||||
case 'C':
|
||||
if(!optarg)
|
||||
break;
|
||||
@ -585,7 +625,23 @@ void unterOption_default_help(std::string programName)
|
||||
std::cout << "Beschreibung:" << std::endl
|
||||
<< " Mit dieser Unterfunktion kann man die Downloadlinks von Serien bekommen." << std::endl << std::endl;
|
||||
|
||||
std::cout << "HOSTEROPTIONEN:" << std::endl
|
||||
|
||||
std::cout << "INTERNETSEITEN OPTIONEN:" << std::endl
|
||||
<< " -i [Url1,Url2], --internet-pages [Url1,Url2]" << std::endl
|
||||
<< " Mit dieser Option kann man die Seiten angeben, auf denen" << std::endl
|
||||
<< " 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
|
||||
<< " -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
|
||||
<< " Priorität nach; siehe -i, --internet-pages)" << std::endl
|
||||
<< " Ohne diesem Parameter ist eine manuelle auswahl nötig," << std::endl
|
||||
<< " wenn diese Serie auf mehreren Seiten existiert!" << std::endl
|
||||
<< " Parameter kann auch im Default File als standart festgelegt werden!" << std::endl
|
||||
<< " Standart: Überprüfe alle Seiten" << std::endl << std::endl
|
||||
<< "HOSTER OPTIONEN:" << std::endl
|
||||
<< " -g [Hoster1,Hoster2,...], --genaue-hoster [Hoster1,Hoster2,...]" << std::endl
|
||||
<< " Mit dieser Option kann man die Hoster angeben, von denen" << std::endl
|
||||
<< " man die Downloadlinks will. Die Auswahl der Hoster geht" << std::endl
|
||||
@ -600,7 +656,7 @@ void unterOption_default_help(std::string programName)
|
||||
<< " denen man die Downloadlinks will. Die Beste als erstes" << std::endl
|
||||
<< " die 2t-Beste als 2tes,..." << std::endl
|
||||
<< " Standart: GerDub,GerSub,Eng" << std::endl << std::endl
|
||||
<< "DURCHLAUFOPTIONEN:" << std::endl
|
||||
<< "DURCHLAUF OPTIONEN:" << std::endl
|
||||
<< " -e [Folge], --start-episode [Folge]" << std::endl
|
||||
<< " Mit dieser Option kann man festlegen, mit welcher Folge" << std::endl
|
||||
<< " das Programm startet." << std::endl << std::endl
|
||||
@ -629,7 +685,7 @@ void unterOption_default_help(std::string programName)
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
<< " Standart: 127.0.0.1:9050 - Port 0 um Proxy zu deaktivieren." << std::endl << std::endl
|
||||
<< "AUSGABEOPTIONEN:" << std::endl
|
||||
<< "AUSGABE OPTIONEN:" << std::endl
|
||||
<< " -o [Pfad], --output-file [Pfad]" << std::endl
|
||||
<< " Mit diere Option kann man eine (nichtvorhandene) Text-Datei" << std::endl
|
||||
<< " angeben, inwelche die umgewandelten Redirect-Links geschrieben" << std::endl
|
||||
@ -640,7 +696,7 @@ void unterOption_default_help(std::string programName)
|
||||
<< " -d, --debug-mode" << std::endl
|
||||
<< " Mit dieser Option kann man den Debug-Modus einschalten." << std::endl
|
||||
<< " Dabei werden vielmehr Infos ausgegeben." << std::endl << std::endl
|
||||
<< "SELEKTOROPTIONEN:" << std::endl
|
||||
<< "SELEKTOR OPTIONEN:" << std::endl
|
||||
<< " -C [PfadZuOrdner], --check [PfadZuOrdner]" << std::endl
|
||||
<< " Mit dieser Option kann man einen Ordner festlegen, in dem" << std::endl
|
||||
<< " und dessen Unterordnern ( Beachte -D ) das Programm erst" << std::endl
|
||||
@ -691,16 +747,20 @@ int unterOption_url(Settings *settings, int argc, char **argv)
|
||||
const option long_opts[] = {
|
||||
{"socks5-proxy", required_argument, nullptr, 'p'},
|
||||
{"output-file", required_argument, nullptr, 'o'},
|
||||
{"standart-page", required_argument, nullptr, 's'},
|
||||
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"colorless", no_argument, nullptr, 'c'},
|
||||
{"debug-mode", no_argument, nullptr, 'd'},
|
||||
{"use-first-page", no_argument, nullptr, 'f'},
|
||||
|
||||
{nullptr, no_argument, nullptr, 0}
|
||||
|
||||
};
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:o:hcd", long_opts, nullptr) ) != -1 ) {
|
||||
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:o:s:fhcd", long_opts, nullptr) ) != -1 ) {
|
||||
switch(c) {
|
||||
case 'p':
|
||||
if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
|
||||
@ -712,11 +772,35 @@ int unterOption_url(Settings *settings, int argc, char **argv)
|
||||
if(settings->debugMode)
|
||||
std::cout << "Pfad zu Output-Datei: " << settings->outputFilePaths.back() << std::endl;
|
||||
break;
|
||||
case 'f':
|
||||
settings->useFirstPage = true;
|
||||
if(settings->debugMode)
|
||||
std::cout << "useFirstPage: " << settings->useFirstPage << std::endl;
|
||||
break;
|
||||
case 'c':
|
||||
settings->colorless = true;
|
||||
if(settings->debugMode)
|
||||
std::cout << "Farblos: true" << std::endl;
|
||||
break;
|
||||
case 's':
|
||||
if(!optarg)
|
||||
break;
|
||||
if( std::string(optarg) == settings->sto.url || std::string(optarg) == "s.to" ) {
|
||||
settings->direktLink_explizitPage = settings->sto;
|
||||
if(settings->debugMode)
|
||||
std::cout << " > Defaults: Standart-Page-für-direkt-link-mode: " << settings->sto.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;
|
||||
case 'd':
|
||||
settings->debugMode = true;
|
||||
if(settings->debugMode)
|
||||
@ -762,7 +846,20 @@ void unterOption_url_help(std::string programName)
|
||||
<< " Der Link kann folgen Aussehen: {[*]serienstream.sx}/redirect/[*]." << std::endl
|
||||
<< " Standartwerte können im Defaultfile geändert werden." << std::endl << std::endl;
|
||||
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
std::cout << "INTERNETSEITEN OPTIONEN:" << 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
|
||||
<< " Priorität nach; siehe -i, --internet-pages)" << std::endl
|
||||
<< " Ohne diesem Parameter ist eine manuelle auswahl nötig," << std::endl
|
||||
<< " wenn diese Serie auf mehreren Seiten existiert!" << std::endl
|
||||
<< " Parameter kann auch im Default File als standart festgelegt werden!" << std::endl
|
||||
<< " Standart: Überprüfe alle Seiten" << std::endl
|
||||
<< " -s [url], --standart-page [url]" << std::endl
|
||||
<< " Mit dieser Option kann man festlegen, welche Seite für unvollständige" << std::endl
|
||||
<< " Redirect Links ( z.B. /redirect/xyz ) verwendet werden soll." << std::endl
|
||||
<< " Default: deaktiviert" << std::endl << std::endl;
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
<< " Standart: 127.0.0.1:9050 - Port 0 um Proxy zu deaktivieren." << std::endl << std::endl
|
||||
@ -786,6 +883,7 @@ int unterOption_search(Settings *settings, int argc, char **argv)
|
||||
int c = 0;
|
||||
const option long_opts[] = {
|
||||
{"socks5-proxy", required_argument, nullptr, 'p'},
|
||||
{"internet-pages", required_argument, nullptr, 'i'},
|
||||
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"colorless", no_argument, nullptr, 'c'},
|
||||
@ -798,12 +896,19 @@ int unterOption_search(Settings *settings, int argc, char **argv)
|
||||
|
||||
};
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:hcdeul", long_opts, nullptr) ) != -1 ) {
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:i:hcdeul", long_opts, nullptr) ) != -1 ) {
|
||||
switch(c) {
|
||||
case 'p':
|
||||
if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
|
||||
return 2;
|
||||
break;
|
||||
case 'i':
|
||||
if(!optarg)
|
||||
break;
|
||||
if(setUpInternetPages(*settings, optarg) != 0)
|
||||
return 4356;
|
||||
break;
|
||||
case 'h':
|
||||
unterOption_search_help(settings->programName);
|
||||
return -1;
|
||||
@ -862,6 +967,7 @@ void unterOption_search_help(std::string programName)
|
||||
<< " " << programName << " search [OPTION]... [{-u, --update}&|/{-l, --last-update}]" << std::endl
|
||||
<< " " << programName << " search [OPTION]... [{-u, --update}&|/{-l, --last-update}] [Name]" << std::endl << std::endl;
|
||||
|
||||
|
||||
std::cout << "Beschreibung:" << std::endl
|
||||
<< " Mit dieser Unterfunktion des Programms kann man Serien auf serienstream.sx suchen." << std::endl
|
||||
<< " Tipp: Falls deine Serie nicht gefunden wird, entferne einen Teil" << std::endl
|
||||
@ -880,6 +986,14 @@ void unterOption_search_help(std::string programName)
|
||||
<< " nach wie vielen Tagen du an das Updaten erinert wirst." << std::endl
|
||||
<< " Default: 10 Tage." << std::endl << std::endl;
|
||||
|
||||
std::cout << "INTERNETSEITEN OPTIONEN:" << std::endl
|
||||
<< " -i [Url1,Url2], --internet-pages [Url1,Url2]" << std::endl
|
||||
<< " Mit dieser Option kann man die Seiten angeben, auf denen" << std::endl
|
||||
<< " 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;
|
||||
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
@ -907,7 +1021,9 @@ int unterOption_info(Settings *settings, int argc, char **argv)
|
||||
const option long_opts[] = {
|
||||
{"socks5-proxy", required_argument, nullptr, 'p'},
|
||||
{"output-file", required_argument, nullptr, 'o'},
|
||||
{"internet-pages", 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'},
|
||||
@ -917,7 +1033,7 @@ int unterOption_info(Settings *settings, int argc, char **argv)
|
||||
|
||||
};
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:o:hcds", long_opts, nullptr) ) != -1 ) {
|
||||
while( ( c = getopt_long (argc, argv, "p:o:i:fhcds", long_opts, nullptr) ) != -1 ) {
|
||||
switch(c) {
|
||||
case 'p':
|
||||
if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
|
||||
@ -929,6 +1045,17 @@ int unterOption_info(Settings *settings, int argc, char **argv)
|
||||
if(settings->debugMode)
|
||||
std::cout << "Pfad zu Output-Datei: " << settings->outputFilePaths.back() << std::endl;
|
||||
break;
|
||||
case 'i':
|
||||
if(!optarg)
|
||||
break;
|
||||
if(setUpInternetPages(*settings, optarg) != 0)
|
||||
return 4356;
|
||||
break;
|
||||
case 'f':
|
||||
settings->useFirstPage = true;
|
||||
if(settings->debugMode)
|
||||
std::cout << "useFirstPage: " << settings->useFirstPage << std::endl;
|
||||
break;
|
||||
case 'h':
|
||||
unterOption_info_help(settings->programName);
|
||||
return -1;
|
||||
@ -978,6 +1105,22 @@ void unterOption_info_help(std::string programName)
|
||||
std::cout << "Beschreibung:" << std::endl
|
||||
<< " Mit dieser Unterfunktion kann man Informationen zu einer Serie bekommen." << std::endl << std::endl;
|
||||
|
||||
std::cout << "INTERNETSEITEN OPTIONEN:" << std::endl
|
||||
<< " -i [Url1,Url2], --internet-pages [Url1,Url2]" << std::endl
|
||||
<< " Mit dieser Option kann man die Seiten angeben, auf denen" << std::endl
|
||||
<< " 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
|
||||
<< " -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
|
||||
<< " Priorität nach; siehe -i, --internet-pages)" << std::endl
|
||||
<< " Ohne diesem Parameter ist eine manuelle auswahl nötig," << std::endl
|
||||
<< " wenn diese Serie auf mehreren Seiten existiert!" << std::endl
|
||||
<< " Parameter kann auch im Default File als standart festgelegt werden!" << std::endl
|
||||
<< " Standart: Überprüfe alle Seiten" << std::endl << std::endl;
|
||||
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
@ -1212,7 +1355,9 @@ int unterOption_news(Settings *settings, int argc, char **argv)
|
||||
int c = 0;
|
||||
const option long_opts[] = {
|
||||
{"socks5-proxy", required_argument, nullptr, 'p'},
|
||||
{"use-first-page", no_argument, nullptr, 'f'},
|
||||
|
||||
{"internet-pages", required_argument, nullptr, 'i'},
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"colorless", no_argument, nullptr, 'c'},
|
||||
{"debug-mode", no_argument, nullptr, 'd'},
|
||||
@ -1221,12 +1366,23 @@ int unterOption_news(Settings *settings, int argc, char **argv)
|
||||
|
||||
};
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:hcd", long_opts, nullptr) ) != -1 ) {
|
||||
while( ( c = getopt_long (argc, argv, "p:i:fhcd", long_opts, nullptr) ) != -1 ) {
|
||||
switch(c) {
|
||||
case 'p':
|
||||
if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
|
||||
return 2;
|
||||
break;
|
||||
case 'i':
|
||||
if(!optarg)
|
||||
break;
|
||||
if(setUpInternetPages(*settings, optarg) != 0)
|
||||
return 4356;
|
||||
break;
|
||||
case 'f':
|
||||
settings->useFirstPage = true;
|
||||
if(settings->debugMode)
|
||||
std::cout << "useFirstPage: " << settings->useFirstPage << std::endl;
|
||||
break;
|
||||
case 'h':
|
||||
unterOption_news_help(settings->programName);
|
||||
return -1;
|
||||
@ -1261,6 +1417,21 @@ void unterOption_news_help(std::string programName)
|
||||
std::cout << "Beschreibung:" << std::endl
|
||||
<< " Mit dieser Unterfunktion kann man die neuesten 75 Folgen auf serienstream.sx sehen." << std::endl << std::endl;
|
||||
|
||||
std::cout << "INTERNETSEITEN OPTIONEN:" << std::endl
|
||||
<< " -i [Url1,Url2], --internet-pages [Url1,Url2]" << std::endl
|
||||
<< " Mit dieser Option kann man die Seiten angeben, auf denen" << std::endl
|
||||
<< " 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
|
||||
<< " -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
|
||||
<< " Priorität nach; siehe -i, --internet-pages)" << std::endl
|
||||
<< " Ohne diesem Parameter ist eine manuelle auswahl nötig," << std::endl
|
||||
<< " wenn diese Serie auf mehreren Seiten existiert!" << std::endl
|
||||
<< " Parameter kann auch im Default File als standart festgelegt werden!" << std::endl
|
||||
<< " Standart: Überprüfe alle Seiten" << std::endl << std::endl;
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
@ -1346,7 +1517,7 @@ void unterOption_update_help(std::string programName)
|
||||
}
|
||||
|
||||
|
||||
bool removeDirIsOk(std::string path, Settings *settings)
|
||||
bool removeDirIsOk(std::string path, Settings *settings, bool askForDelete)
|
||||
{
|
||||
if(path == "") {
|
||||
std::cout << " => Error: Ungültiger Pfad: '" << path << "'." << std::endl;
|
||||
@ -1354,10 +1525,11 @@ bool removeDirIsOk(std::string path, Settings *settings)
|
||||
} else if(path.back() != settings->pathSymbol )
|
||||
path.push_back(settings->pathSymbol);
|
||||
|
||||
if(settings->askForEveryDir) {
|
||||
if(askForDelete) {
|
||||
std::cout << "Zur Bestätigung des Löschens des Ordners: '" << path << "'," << std::endl
|
||||
<< "geben sie 'OK' ein: " << std::flush;
|
||||
std::string input;
|
||||
std::cin.clear();
|
||||
std::getline(std::cin, input);
|
||||
if(input != "OK") {
|
||||
std::cout << "Abbruch..." << std::endl;
|
||||
@ -1366,7 +1538,6 @@ bool removeDirIsOk(std::string path, Settings *settings)
|
||||
|
||||
}
|
||||
|
||||
|
||||
DIR* dirp = nullptr;
|
||||
if( (dirp = opendir( path.c_str() )) == nullptr ) {
|
||||
perror(std::string(" => Error: Konnte Verzeichnis nicht öffnen: '" + path + "'").c_str());
|
||||
@ -1378,7 +1549,7 @@ bool removeDirIsOk(std::string path, Settings *settings)
|
||||
if(strcmp( dp->d_name, "." ) == 0 || strcmp ( dp->d_name, ".." ) == 0)
|
||||
continue;
|
||||
else if(dirExists((path + dp->d_name + settings->pathSymbol ))) { //if(dp->d_type == DT_DIR) {
|
||||
if( ! removeDirIsOk(path + dp->d_name + settings->pathSymbol , settings)) {
|
||||
if( ! removeDirIsOk(path + dp->d_name + settings->pathSymbol , settings, false/*askForDelete*/)) {
|
||||
if(settings->debugMode)
|
||||
std::cout << " => Error im Unterordner: '" << path + dp->d_name << "'" << std::endl;
|
||||
return false;
|
||||
@ -1600,3 +1771,36 @@ std::string replace(std::string str, std::string substr1, std::string substr2)
|
||||
str.replace(index, substr1.length(), substr2);
|
||||
return str;
|
||||
}
|
||||
|
||||
int setUpInternetPages(Settings &settings, std::string optarg)
|
||||
{
|
||||
//Lösche default
|
||||
settings.pages.clear();
|
||||
|
||||
std::istringstream ss(optarg + ",");
|
||||
std::string value;
|
||||
|
||||
while(std::getline(ss, value, ',')) {
|
||||
if(value == "")
|
||||
continue;
|
||||
if( value == settings.sto.url || value == "s.to" ) {
|
||||
settings.pages.push_back(settings.sto);
|
||||
if(settings.debugMode)
|
||||
std::cout << " > : Internetseiten pusback: " << settings.sto.url << std::endl;
|
||||
|
||||
} else if ( value == settings.anicio.url ) {
|
||||
settings.pages.push_back(settings.anicio);
|
||||
if(settings.debugMode)
|
||||
std::cout << " > : Internetseiten pusback: " << settings.anicio.url << std::endl;
|
||||
|
||||
} else {
|
||||
std::cout << " => Error: Unbekannte Internetseiten: " << value << " - Bitte überprüfen sie ihr Default File oder ggf. Parameter -i" << std::endl;
|
||||
return 2154;
|
||||
}
|
||||
}
|
||||
if(settings.pages.size() < 1) {
|
||||
std::cout << " => Keine Internetseiten angegeben! " << std::endl;
|
||||
return 1236;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -62,6 +62,9 @@ struct Settings {
|
||||
const std::string programName = "S_New4";
|
||||
PAGE sto = PAGE( "serienstream.sx", "Normale_Serien", "/serien-alphabet", "/serie/stream/");
|
||||
PAGE anicio = PAGE( "anicloud.io", "Animes", "/animes-alphabet", "/anime/stream/");
|
||||
PAGE pagesALL[2] = { sto, anicio };
|
||||
|
||||
|
||||
std::vector<PAGE> pages; // Priority sorted
|
||||
bool useFirstPage = false;
|
||||
|
||||
@ -167,7 +170,7 @@ bool nothingExists(std::string path);
|
||||
|
||||
bool createDirIsOk(std::string path);
|
||||
bool makePathIsOk(std::string path);
|
||||
bool removeDirIsOk(std::string path, Settings *settings);
|
||||
bool removeDirIsOk(std::string path, Settings *settings, bool askForDelete);
|
||||
|
||||
int unterOption_help(Settings &settings);
|
||||
void unterOption_printVersion(Settings &settings);
|
||||
@ -199,7 +202,7 @@ int unterOption_printLogFile(Settings * settings, int argc, char **argv);
|
||||
void unterOption_printLogFile(std::string programName);
|
||||
|
||||
int setS5ProxytoSettings(Settings &settings, std::string optarg);
|
||||
|
||||
int setUpInternetPages(Settings &settings, std::string optarg);
|
||||
|
||||
|
||||
|
||||
|
@ -47,6 +47,7 @@ int ProgramManager::start(Settings *settings)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void * threadFunction(void * data) {
|
||||
ThreadData * myThreadData = reinterpret_cast<struct ThreadData*>(data);
|
||||
myThreadData->returnValue="";
|
||||
@ -118,6 +119,11 @@ void * threadFunction(void * data) {
|
||||
return myThreadData->setState(16);
|
||||
|
||||
// Get redirect link after getUrlAfterRedirect function
|
||||
} else if ( REPLy.html.find("404 - Seite nicht gefunden") != std::string::npos || REPLy.html.find("403 Forbidden") != std::string::npos) {
|
||||
if(myThreadData->settings->debugMode)
|
||||
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": getUrlAfterRedirect Function failed: 404 - Seite nicht gefunden oder 403 Forbidden." << std::endl;
|
||||
return myThreadData->setState(404);
|
||||
|
||||
} 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;
|
||||
@ -129,12 +135,7 @@ void * threadFunction(void * data) {
|
||||
continue;
|
||||
|
||||
// get NO-Redirect Link after getUrlAfterRedirect Function
|
||||
}else if ( REPLy.html.find("404 - Seite nicht gefunden") != std::string::npos) {
|
||||
if(myThreadData->settings->debugMode)
|
||||
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": getUrlAfterRedirect Function failed: 404 - Seite nicht gefunden." << std::endl;
|
||||
return myThreadData->setState(404);
|
||||
|
||||
} else {
|
||||
} else {
|
||||
if( (newUrl = myThreadData->pageManager->getLinkAfterHosterBasedOperation(newUrl)) == "") {
|
||||
if(myThreadData->settings->debugMode)
|
||||
std::cout << " => Error in getLinkAfterHosterBasedOperation() -> exit threadFunction()" << std::endl;
|
||||
@ -373,10 +374,25 @@ int ProgramManager::checkLastUpdate(Settings *settings, ssize_t *days = nullptr)
|
||||
|
||||
std::ifstream ifs(settings->lastUpdateDateFilePath);
|
||||
if(!ifs.is_open()) {
|
||||
perror(("Konnte die Datei '" + settings->lastUpdateDateFilePath + "' nicht öffnen").c_str());
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Failed to open Last Update Date File:'" << settings->lastUpdateDateFilePath << "'." << std::endl;
|
||||
return 1;
|
||||
std::ofstream ofs2(settings->lastUpdateDateFilePath);
|
||||
if(!ofs2.is_open()) {
|
||||
perror(("Konnte die Datei '" + settings->lastUpdateDateFilePath + "' nicht öffnen").c_str());
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Failed to create Last Update Date File:'" << settings->lastUpdateDateFilePath << "'." << std::endl;
|
||||
return 1;
|
||||
} else {
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Ordfolgreich LastUpdateTime Save File erstellt:'" << settings->lastUpdateDateFilePath << "'." << std::endl;
|
||||
ofs2 << "0" << std::endl;
|
||||
ofs2.close();
|
||||
ifs.open(settings->lastUpdateDateFilePath);
|
||||
if(!ifs.is_open()) {
|
||||
perror(("Konnte die Datei '" + settings->lastUpdateDateFilePath + "' nicht öffnen").c_str());
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Failed to open Last Update Date File:'" << settings->lastUpdateDateFilePath << "'." << std::endl;
|
||||
return 4545;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string line;
|
||||
ssize_t difDays = 0;
|
||||
@ -485,7 +501,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
||||
<< settings->cookieFilePath + "_" + page.name_id + std::to_string( i ) << "'." << std::endl;
|
||||
return 174;
|
||||
}
|
||||
PageManager * pm = new PageManager(settings->proxy_ip + ":" + std::to_string(settings->proxy_port), settings->cookieFilePath + "_" + page.name_id + std::to_string( i ));
|
||||
PageManager * pm = new PageManager(settings->proxy_ip + ":" + std::to_string(settings->proxy_port));
|
||||
pm->setDebugMode(settings->debugMode);
|
||||
|
||||
//pm->setProxy(settings->proxy_ip, settings->proxy_port);
|
||||
@ -704,7 +720,8 @@ int ProgramManager::directLinkModus(Settings *settings)
|
||||
|
||||
} else if(line.find("://") == std::string::npos) {
|
||||
if(settings->direktLink_explizitPage.url == "") {
|
||||
std::cout << " => Kann '://' bei '" << line << "' nicht finden: Benutze -e [PAGE], --explizit [PAGE], um /redirect/xyz umzuwandeln" << std::endl;
|
||||
std::cout << " => Kann '://' bei '" << line << "' die Internetseite nicht finden: Benutze -s [url], --standart-page [url]," << std::endl
|
||||
<< " um /redirect/xyz Links für die Internetseite <url> (z.B. anicloud.io) umzuwandel.n" << std::endl;
|
||||
continue;
|
||||
}
|
||||
redL = line.erase(0, line.find("/redirect/"));
|
||||
@ -730,7 +747,7 @@ int ProgramManager::directLinkModus(Settings *settings)
|
||||
}
|
||||
|
||||
AccountManager accountManager(settings->accountFilePath, settings->accountNumberPath, page);
|
||||
std::cout << "CONVERT LINK: '" << redL << "' -> URL: " << page.url << std::endl;
|
||||
|
||||
if(convertLink(page, redL, &accountManager, settings) != 0) {
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl;
|
||||
@ -745,8 +762,8 @@ int ProgramManager::directLinkModus(Settings *settings)
|
||||
|
||||
int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool noPrint)
|
||||
{
|
||||
ssize_t dayddiff;
|
||||
if(settings->showLastUpdate) {
|
||||
ssize_t dayddiff;
|
||||
if(checkLastUpdate(settings, &dayddiff) != 0) {
|
||||
std::cout << " => Error: CheckLasUpdate-Funktion gab einen Error zurück." << std::endl;
|
||||
return -1;
|
||||
@ -814,7 +831,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no
|
||||
std::string serienListe = std::string((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
|
||||
|
||||
//Suche alle Möglichkeiten
|
||||
std::string finds = pageManager.grep(serienListe, settings->name, settings->search_IgnoreUpperLower);
|
||||
std::string fullList = pageManager.grep(serienListe, settings->name, settings->search_IgnoreUpperLower);
|
||||
serienListe.clear(); // Speicher freigeben
|
||||
|
||||
/*//Text mit Farben versehen
|
||||
@ -825,6 +842,24 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no
|
||||
finds.insert(pos, ( (finds.find(settings->name, pos) == pos) ? "\033[32m" : "\033[36m" ) ).insert(pos + settings->name.length() + strlen("\033[37m"), "\033[0m");
|
||||
}*/
|
||||
|
||||
std::string finds;
|
||||
|
||||
//------------------------------------------------> Extrahiere alle Zeilen raus, die aus den Aktivierten Seiten sind
|
||||
std::istringstream ifS(fullList + "\n");
|
||||
std::string l, allUrls;
|
||||
for( const auto &p : settings->pages )
|
||||
allUrls += ((allUrls == "") ? "" : ",") + p.url;
|
||||
|
||||
while (std::getline(ifS, l)) {
|
||||
if( l.find_last_of('|') == std::string::npos ) {
|
||||
std::cout << "Invalid Line: '" << l << "'" << std::endl;
|
||||
continue;
|
||||
} else if( allUrls.find( l.substr(l.find_last_of('|') + 1) ) != std::string::npos )
|
||||
finds += l + "\n";
|
||||
} if(finds.size() >= 1)
|
||||
finds.pop_back();
|
||||
//-------------------------------------------
|
||||
|
||||
if(saveTo) {
|
||||
//Save List to Variable if set
|
||||
*saveTo=finds;
|
||||
@ -875,10 +910,13 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no
|
||||
|
||||
std::cout << " > " << parts.at(2) << "\t[" << parts.at(1).erase(0, 1) << "]"
|
||||
<< ( (line[0] == '|') ? "" : "\t( " + parts.at(0) + " )" ) << std::endl;
|
||||
//zähne hoch!!
|
||||
|
||||
///That Time I Got Reincarnated as a Slime|/tensei-shitara-slime-datta-ken|Tensei Shitara Slime Datta Ken|ANIME
|
||||
} /// > Tensei Shitara Slime Datta Ken [tensei-shitara-slime-datta-ken] ( That Time I Got Reincarnated as a Slime ) <s.to>
|
||||
|
||||
|
||||
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": success." << std::endl;
|
||||
return 0;
|
||||
@ -1471,7 +1509,7 @@ int ProgramManager::cleanUpSettingsAndCache(Settings *settings)
|
||||
|
||||
//setting dir
|
||||
if(settings->name == "SETTINGS" || settings->name == "ALL") {
|
||||
if( ! removeDirIsOk(settings->configDir, settings)) {
|
||||
if( ! removeDirIsOk(settings->configDir, settings, settings->askForEveryDir)) {
|
||||
std::cout << " => Error: Das löschen des Settings-Ordners ist fehlgeschlagen." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
@ -1479,8 +1517,9 @@ int ProgramManager::cleanUpSettingsAndCache(Settings *settings)
|
||||
}
|
||||
|
||||
//Cache Dir
|
||||
else if (settings->name == "CACHE" || settings->name == "ALL") {
|
||||
if( ! removeDirIsOk(settings->cacheDir, settings)) {
|
||||
|
||||
if (settings->name == "CACHE" || settings->name == "ALL") {
|
||||
if( ! removeDirIsOk(settings->cacheDir, settings, settings->askForEveryDir)) {
|
||||
std::cout << " => Error: Das löschen des Cache-Ordners ist fehlgeschlagen." << std::endl;
|
||||
return 2;
|
||||
}
|
||||
@ -1508,7 +1547,10 @@ int ProgramManager::searchModus_update(Settings *settings)
|
||||
return 1290;
|
||||
}
|
||||
|
||||
for ( const auto &page : settings->pages ) {
|
||||
|
||||
//darf nicht weniger werden!!
|
||||
|
||||
for ( const auto &page : settings->pagesALL ) {
|
||||
std::cout << " -> Updating '" << page.name_id << "'..." << std::endl;
|
||||
|
||||
Reply reply = pageManager.getServerRequest("https://" + page.url + page.urlAlphabetSerienList);
|
||||
@ -1761,6 +1803,17 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana
|
||||
return 102;
|
||||
|
||||
// wenn nach der Umwandlung immern och ein redirect vorhanden ist, also wenn z.B.: account gewechselt werden muss
|
||||
} else if (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 << "'"
|
||||
<< ((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://" + page.url + redirectLink) != 0) {
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
|
||||
return 108;
|
||||
}
|
||||
return 0;
|
||||
//sonst war die umwandlung erfolgreich
|
||||
} 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;
|
||||
@ -1772,17 +1825,6 @@ int ProgramManager::convertLink(PAGE page, std::string redirectLink, AccountMana
|
||||
continue;
|
||||
|
||||
//wenn nach der Umwandlung https://seriens tream.sx/ vorhanden ist, die ist wenn der Link Ungültig war:
|
||||
} else if (newUrl == "https://" + page.url + "/" || rEply.html.find("404 - Seite nicht gefunden") != std::string::npos) {
|
||||
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://" + page.url + redirectLink) != 0) {
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
|
||||
return 108;
|
||||
}
|
||||
return 0;
|
||||
//sonst war die umwandlung erfolgreich
|
||||
} else {
|
||||
if( (newUrl = pageManager.getLinkAfterHosterBasedOperation(newUrl)) == "") {
|
||||
if(settings->debugMode)
|
||||
|
Loading…
Reference in New Issue
Block a user