Alterserv

ThunderCache 3.1.x => Plugins para ThunderCache 3.1.2 => Mensaje publicado por: nqm74 en Octubre 30, 2013, 08:22:19 PM

Título: Plugin TeamViewer
Publicado por: nqm74 en Octubre 30, 2013, 08:22:19 PM
Código (cpp) [Seleccionar]
#include <iostream>
   #include <cstring>
   #include <vector>
   #include "../utils.cpp"
   
   // use this line to compile
   // g++ -I. -fPIC -shared -g -o teamviewer.com.so teamviewer.com.cpp
   // regex
   // http.*\.teamviewer\.com.*(\.jpg|\.png|\.gif|\.exe|\.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()-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(".teamviewer.com/") != string::npos)
      ) {
       
          r.file = get_filename(url);
         if (!r.file.empty()) {
            r.match = true;        
            r.domain = "teamviewer.com";
         } else {
            r.match = false;
         }
      } else {
         r.match = false;
      }
      return r;
   }
Título: Re:Plugin TeamViewer
Publicado por: zeronett en Noviembre 02, 2013, 11:19:51 PM
Gracias por el aporte.   :-*