#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"
// use this line to compile
// g++ -I. -fPIC -shared -g -o canaima.softwarelibre.gob.ve.so canaima.softwarelibre.gob.ve.cpp
// regex
// http.*\.vit\.gob\.ve.*(\.jpg|\.png|\.gif)
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()-1);
} else {
stringexplode(url, "/", &resultado);
return resultado.at(resultado.size()-1);
}
}
extern "C" resposta getmatch(const string url) {
resposta r;
if ( (url.find(".canaima.softwarelibre.gob.ve/") != string::npos) and ((url.find(".jpg") != string::npos) or (url.find(".png") != string::npos) or (url.find(".gif") != string::npos))
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "canaima.softwarelibre";
} else {
r.match = false;
}
} else {
r.match = false;
}
return r;
}
podrian decirme donde estoy cometiendo el error saludos
Cita de: JoseM14 en Octubre 23, 2013, 12:52:22 PM
#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"
// use this line to compile
// g++ -I. -fPIC -shared -g -o canaima.softwarelibre.gob.ve.so canaima.softwarelibre.gob.ve.cpp
// regex
// http.*\.vit\.gob\.ve.*(\.jpg|\.png|\.gif)
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()-1);
} else {
stringexplode(url, "/", &resultado);
return resultado.at(resultado.size()-1);
}
}
extern "C" resposta getmatch(const string url) {
resposta r;
if ( (url.find(".canaima.softwarelibre.gob.ve/") != string::npos) and ((url.find(".jpg") != string::npos) or (url.find(".png") != string::npos) or (url.find(".gif") != string::npos))
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "canaima.softwarelibre";
} else {
r.match = false;
}
} else {
r.match = false;
}
return r;
}
podrian decirme donde estoy cometiendo el error saludos
Amigo el problema que hay una diferencia en el regex y el nombre del plugin, te mostrare:
// g++ -I. -fPIC -shared -g -o canaima.softwarelibre.gob.ve.so canaima.softwarelibre.gob.ve.cpp
// regex
// http.*\.vit\.gob\.ve.*(\.jpg|\.png|\.gif)
por eso te digo de donde sale el contenido de canaima.softwarelibre.gob.ve o de vit.gob.ve, Saludos
la pagina es esta amigo firecold y sale de hay donde la estoy ubicando podrias verificar si puedes?
http://canaima.softwarelibre.gob.ve/
tu lo hiciste mal ya que para compilar te votarìa error :
// use this line to compile
// g++ -I. -fPIC -shared -g -o canaima.softwarelibre.gob.ve.so canaima.softwarelibre.gob.ve.cpp
// regex
// http.*\.vit\.gob\.ve.*(\.jpg|\.png|\.gif)
serìa asi , veo que tambien de esta web salen descargas en .iso , zip :
// use this line to compile
// g++ -I. -fPIC -shared -g -o canaima.softwarelibre.gob.ve.so canaima.softwarelibre.gob.ve.cpp
// regex
// http.*\.canaima.softwarelibre\.gob\.ve.*(\.jpg|\.png|\.gif|\.swf|\.jpg|\.bmp|\.iso|\.rar|\.zip|\.exe)
intenta crear de nuevo el plugin
Saludos
David M.
Alli lo que quieres en cachear la pagina (contenido) no las actualizaciones cierto? o tambien quieres la las actualizaciones? porque si es asi debes ver de donde salen los paquetes de canaima.
#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"
// use this line to compile
// g++ -I. -fPIC -shared -g -o canaima.softwarelibre.gob.ve.so canaima.softwarelibre.gob.ve.cpp
// regex
// http.*\.canaima.softwarelibre\.gob\.ve.*(\.jpg|\.png|\.gif|\.swf|\.jpg|\.bmp|\.iso|\.rar|\.zip|\.exe)
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()-3)+"_"+resultado.at(resultado.size()-2)+"_"+resultado.at(resultado.size()-1);
} else {
stringexplode(url, "/", &resultado);
return 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(".canaima.softwarelibre.gob.ve/") != string::npos)
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "canaima.softwarelibre/Descargas";
} else {
r.match = false;
}
} else {
r.match = false;
}
return r;
}
Buenas Amigos La verdad Que si no Me Habia Dado Cuenta y lo compile mal ps sim embargo lo volvi hacer como me corrigio el amigo firecold y nada y ahora lo compile como el amigo david y nada una no cachea
lo hice a la volada el plugin mas tarde te paso el plugin corregido, pero que es lo que no cachea las descargas o la pagina?
Saludos
David M.
este plugin hace cache a la pagina web, probado y testeado ok.
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include "../utils.cpp"
using namespace std;
// use this line to compile
// g++ -I. -fPIC -shared -g -o softwarelibre.gob.ve.so softwarelibre.gob.ve.cpp
// regex
// http.*\.softwarelibre\.gob\.ve.*(\.jpg|\.png|\.gif|\.swf|\.bmp)
string dominiotxt="Canaima.softwarelibre.gob.ve";
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()-3)+"_"+resultado.at(resultado.size()-2)+"_"+resultado.at(resultado.size()-1);
} else {
stringexplode(url, "/", &resultado);
return 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(".softwarelibre.gob.ve/") != string::npos) and
((url.find(".jpg")!= string::npos) or
(url.find(".png") != string::npos) or
(url.find(".gif") != string::npos) or
(url.find(".swf") != string::npos) or
(url.find(".bmp")!= string::npos))
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = dominiotxt;
} else {
r.match = false;
}
} else {
r.match = false;
}
return r;
}
Saludos
David M.
Nota :
Faltarìa otro para los .iso y los .md5 su Host:descargas.canaima.softwarelibre.gob.ve
no se porque, pero no desea hacerle proxy a los .iso
a ver si alguien lo intenta.............................
seria bueno pero que tambien le haga cache al las actualizaciones de ese sistema operativo que es basado en debian, gracias
Gracias Hermano :D
Gracias