- Código: Selecionar todos
// g++ -I. -fPIC -shared -g -o goear.com.so goear.com.cpp
#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"
// use this line to compile
// g++ -m32 -I. -fPIC -shared -g -o cnet.com.so cnet.com.cpp
// Ejemplo : http://software-files-a.cnet.com/s/software/12/48/61/57/ccsetup317.exe?token=1335013775_590770cd5220cfe2e7d06ad9d4556b54&lop=link&ptype=3001&ontid=18512&siteId=4&edId=3&spi=88e83e80c485220e07b74f1e810938b4&pid=12486157&psid=10315544&&fileName=ccsetup317.exe
// regex http.*\.software-files-a\.cnet\.com.*(\.exe|\.iso|\.torrent|\.zip|\.rar|\.tar)
string get_filename(string url) {
vector<string> resultado;
string retorna = "";
stringexplode(url, "/", &resultado);
if (resultado.size() > 1){
url = resultado.at(resultado.size()-1);
//url = ccsetup317.exe?token=1335013775_590770cd5220cfe2e7d06ad9d4556b54&lop=link&ptype=3001&ontid=18512&siteId=4&edId=3&spi=88e83e80c485220e07b74f1e810938b4&pid=12486157&psid=10315544&&fileName=ccsetup317.exe
SearchReplace(url,"?","&");
//url = ccsetup317.exe&token=1335013775_590770cd5220cfe2e7d06ad9d4556b54&lop=link&ptype=3001&ontid=18512&siteId=4&edId=3&spi=88e83e80c485220e07b74f1e810938b4&pid=12486157&psid=10315544&&fileName=ccsetup317.exe
resultado.clear();
stringexplode(url, "&", &resultado);
if (resultado.size() > 1){
retorna = resultado.at(0);
}
else {
retorna = "";
}
}
return retorna;
}
extern "C" resposta getmatch(const string url) {
resposta r;
if ( (url.find("software-files-a.cnet.com/") != string::npos) and (url.find("software/") != string::npos) and (
(url.find(".exe") != string::npos) or
(url.find(".iso") != string::npos) or
(url.find(".torrent") != string::npos) or
(url.find(".zip") != string::npos) or
(url.find(".rar") != string::npos) or
(url.find(".tar") != string::npos)
) ) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "download.com";
} else {
r.match = false;
}
}
else
{
r.match = false;
}
return r;
}
plugin Download.com