Hello everyone,
i'm asking if anyone have fix for my problem.
currently i'm writing a plugin to cache xhamster video.
i'm using thundercache engine and raptorcache engine for another server.
the problem is, images cached but video isn't.
below my source plugin.
any help is really apreciated.
i'm asking if anyone have fix for my problem.
currently i'm writing a plugin to cache xhamster video.
i'm using thundercache engine and raptorcache engine for another server.
the problem is, images cached but video isn't.
below my source plugin.
Código [Seleccionar]
#include <iostream>
#include <cstring>
#include <vector>
#include <regex.h>
#include "../utils.cpp"
using namespace std;
// use this line to compile
// g++ -I. -fPIC -shared -g -o xhamster.com.so xhamster.com.cpp
// Regex
// http.*\.xhamster\.com.*(\.swf|\.jpg|\.png|\.gif|\.flv|\.mp4)
// http.*\.xhcdn\.com.*(\.swf|\.jpg|\.png|\.gif|\.flv|\.mp4)
// http.*192\.96\.200\.\d{1,3}\/.*(\.swf|\.jpg|\.png|\.gif|\.flv|\.mp4)
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()-2) + "_" +resultado.at(resultado.size()-1);
}
}
extern "C" resposta getmatch(const string url) {
resposta r;
if ( (url.find("xhamster.com/") != string::npos) or
(url.find("xhcdn.com/") != string::npos) or
(regex_match("192\\.96\\.200\\.\\d{1,3}\\/", url) != "")
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "xhamster";
} else {
r.match = false;
}
} else {
r.match = false;
}
return r;
}
any help is really apreciated.