Advertisement
ipsBruno

(Pascal) Delphi Assistir Vídeo Youtube

Oct 29th, 2012
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.82 KB | None | 0 0
  1.  /*
  2.  *  Copyright (c) 2012 [iPs]TeaM
  3.  *  Bruno da Silva (email@brunodasilva.com)
  4.  *  Ver vídeos em Delphi! Pesquisa dinâmica no youtube. Precisa da função URLEncode !!
  5.  *
  6.  * www.brunodasilva.com
  7.  * www.ips-team.forumeiros.com
  8. */    
  9.  
  10. procedure TForm1.Button1Click(Sender: TObject);
  11.  
  12. var
  13.   iCalc   : integer;
  14.   szData  : string;
  15.   szFile  : string;
  16.  
  17. begin
  18.  
  19.   szData := IdHTTP1.Get('http://www.youtube.com/results?search_query=trailer%20' + URLEncode(edit1.text));
  20.  
  21.  
  22.   iCalc := pos('" data-context-item-id="', szData) + 24;
  23.  
  24.   ShowMessage('Encontrei ' + IntToStr(iCalc));
  25.  
  26.   While (szData[iCalc] <> '"') Do
  27.   Begin
  28.  
  29.     szFile := szFile + szData[iCalc];
  30.     iCalc := iCalc + 1;
  31.  
  32.   End;
  33.  
  34.   ShowMessage('Encontrado ' + szFile);
  35.  
  36.   WebBrowser1.Navigate('http://youtube.googleapis.com/v/' + szFile)  ;
  37.  
  38. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement