Ver Mensaje Individual
  #2  
Antiguo 13-09-2007
Avatar de xEsk
[xEsk] xEsk is offline
Miembro Premium
 
Registrado: feb 2006
Posts: 454
Reputación: 21
xEsk Va por buen camino
Para poder "emular" la validación debes enviar los parámetro por POST. Los parámetro a pasar por POST son: bMonth=01&bDay=1&bYear=1970&verifyAge=true&submit=CONTINUE »

Aquí te pongo un trozo del código que realiza la validación y obtiene el HTML de una página (piensa que el código que te muestro esta hecho usando Synapse para Internet...).

Código Delphi [-]
  // start a custom http instance
  HTTP:=THTTPSend.Create;
  try
    // set the POST parameters
    WriteStrToStream(HTTP.Document, 'bMonth=01&bDay=1&bYear=1970&verifyAge=true&submit=CONTINUE »');
    // Set the Mime Type
    HTTP.MimeType := 'application/x-www-form-urlencoded';
    // Get the page html (send it as POST)
    HTTP.HTTPMethod('POST', 'http://www.pornotube.com/media.php?m=1389132');
    // if all is ok
    if HTTP.ResultCode = 200 then
      begin
        // Aqui ya podemos analizar el código HTML de la pagina! 
        // HTTP.Document --> contiene el HTML de la pagina
      end;
  finally
    HTTP.Free;
  end;
Y aquí el código exacto que uso en el xVideoServiceThief para obtener la URL del video FLV en PornoTube (añadido hoy, y disponible en la próxima actualización):
Código Delphi [-]
function TVideoDownload_PornoTube.GetVideoInformation(
  const URL: String): TVideoDownloadInfo;
const
  AGE_VALIDATION = 'bMonth=01&bDay=1&bYear=1970&verifyAge=true&submit=CONTINUE »';
  GET_FLV_INFO_URL = 'http://www.pornotube.com/player/player.php?%s';
  GET_FLV_URL = 'http://%s.pornotube.com/%s/%s.flv';

var
  Html: TStringList;
  HTTP: THTTPSend;
  VideoID: String;
  FlvID: String;
  FUserID: String;
  FDomain: String;

begin
  // clear possible prev. data
  InitTVideoDownloadInfo(Result);
  // start a custom http instance
  HTTP:=THTTPSend.Create;
  try
    // set the POST parameters
    WriteStrToStream(HTTP.Document, AGE_VALIDATION);
    // Set the Mime Type
    HTTP.MimeType := 'application/x-www-form-urlencoded';
    // Get the page html (send it as POST)
    HTTP.HTTPMethod('POST', URL);
    // if all is ok
    if HTTP.ResultCode = 200 then
      begin
        Html:=TStringList.Create;
        try
          // get the html
          Html.LoadFromStream(HTTP.Document);
          // get the video Title
          Result.Title:=CopyBetween(Html.Text, 'PornoTube.com - '</span>, <span class='quote'>'');
          Result.Title:=Copy(Result.Title, 1, Pos(' - Browsing: Videos -', Result.Title) - 1);
          // get the video ID
          VideoID:=CopyBetween(Html.Text, 'player/v.swf?v=', '"');
          // get the video Information
          HTTP.Clear;
          HTTP.HTTPMethod('GET', Format(GET_FLV_INFO_URL, [VideoID]));
          if HTTP.ResultCode = 200 then
            begin
              // get the html
              Html.LoadFromStream(HTTP.Document);
              // get the video ID
              FlvID:=CopyBetween(Html.Text, 'mediaId=', '&');
              // get the User ID
              FUserID:=CopyBetween(Html.Text, 'userId=', '&');
              // get the video domain
              FDomain:=CopyBetween(Html.Text, 'mediaDomain=', '&');
              // get the final FLV url
              Result.VideoURL:=Format(GET_FLV_URL, [FDomain, FUserID, FlvID]);
              // clear and get the final flv url
              Result.VideoURL:=URLtoAscii(Result.VideoURL);
            end;
        finally
          Html.Free;
        end;
      end;
  finally
    HTTP.Free;
  end;
end;
Saludos.

Última edición por xEsk fecha: 13-09-2007 a las 16:23:16.
Responder Con Cita