#include #include #include #include "../utils.cpp" // use this line to compile // g++ -I. -fPIC -shared -g -o speedtest.net.so speedtest.net.cpp // regex // http.*\.movistar\.com\.pe.*\.jpg // http.*\.claro\.com\.pe.*\.jpg // http.*\.olo\.com\.pe.*\.jpg string get_filename(string url) { vector resultado; if (url.find("?") != string::npos) { stringexplode(url, "?", &resultado); stringexplode(resultado.at(resultado.size()-2), "/", &resultado); return resultado.at(resultado.size()-1); } else { stringexplode(url, "/", &resultado); return resultado.at(resultado.size()-1); } } extern "C" resposta hgetmatch2(const string url) { resposta r; r.range_min = 0; r.range_max = 0; if ( (url.find(".movistar.com.pe/") != string::npos) and ( (url.find(".jpg") != string::npos) or (url.find(".swf") != string::npos) ) and (url.find("claro.com.pe") == string::npos) and (url.find("olo.com.pe") == string::npos) ) { r.file = get_filename(url); if (!r.file.empty()) { r.match = true; r.domain = "speedtest"; } else { r.match = false; } } else { r.match = false; } return r; }