Testeado y Probado
#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"
// use this line to compile
// g++ -I. -fPIC -shared -g -o heroesofnewerth.com.so heroesofnewerth.com.cpp
// Regex
// http.*\.heroesofnewerth\.com.*(\.ogg|\.zip|\.mp3|\.swf|\.gif|\.jpg|\.rar)
string get_filename(string url) {
vector<string> resultado;
if (url.find("?") != string::npos) {
stringexplode(url, "?", &resultado);
stringexplode(resultado.at(resultado.size()-2), "/", &resultado);
return resultado.at(resultado.size()-4) + "_" + resultado.at(resultado.size()-3) + "_" + resultado.at(resultado.size()-2) + "_" +resultado.at(resultado.size()-1);
} else {
stringexplode(url, "/", &resultado);
return resultado.at(resultado.size()-4) + "_" + resultado.at(resultado.size()-3) + "_" + resultado.at(resultado.size()-2) + "_" +resultado.at(resultado.size()-1); ;
}
}
extern "C" resposta getmatch(const string url) {
resposta r;
if ( (url.find("dl.heroesofnewerth.com/") != string::npos)
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "HoN_Latino-Axexo5";
} else {
r.match = false;
}
} else {
r.match = false;
}
return r;
}
Saludos..........................................