Solved

Use Delphi to get YouTube url (or t parameter)

Posted on 2008-06-20
4
2,424 Views
Last Modified: 2012-06-27
Hello everyone


Is there a way to get YouTube redirect video url

for example:
http://www.youtube.com/v/V3BsjxDZJM0

Above URL is used in YouTube embed-code. It is basically a server-side redirection that points to YouTube Player (.swf). Above redirects (server-side) to following URL:-

http://www.youtube.com/p.swf?video_id=V3BsjxDZJM0&eurl=&iurl=http%3A//sjc-
static12.sjc.youtube.com/vi/V3BsjxDZJM0/2.jpg&t=OEgsToPDskKzlTMEFZ1jOh40Xc3qOxzQ

Is it possible to get t parameter OEgsToPDskKzlTMEFZ1jOh40Xc3qOxzQ using Delphi?

Thanks

ZW
0
Comment
Question by:interdev
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
alex_code earned 250 total points
ID: 21837272
Use this function:

function GetUrl(Browser:String): String;
var
DdeClientConv:TDdeClientConv;
Temp :string;
URL :string;
Title :string;
begin
DdeClientConv:=TDdeClientConv.Create(Form1);
with DdeClientConv do
  begin
  // ConnectMode := ddeManual;

   if SetLink(Browser, 'WWW_GetWindowInfo' )then
         Temp:=RequestData('0xFFFFFFFF,sURL,sTitle');
    while Pos('"',Temp) > 0 do //(Single Double Single quotes)
         Delete(Temp,Pos('"',Temp),1); //Remove the quotes(Single Double Single quotes)

    URL:=Copy(Temp,1,Pos(',',Temp)-1); //Get URL
    Title:=Copy(Temp,Pos(',',Temp)+1,Length(Temp)); //Get title
    end;

DdeClientConv.Free;
Result := URL;
end;


... and then drop an editbox and a button and to button's click event paste this

 edit1.Text:=GetURL('IExplore');

if you are using firefox write:  edit1.Text:=GetURL('Firefox');
0
 
LVL 9

Expert Comment

by:alex_code
ID: 21837279
This will give you the whole link that address bar has and then you can split the link after the "="
 character and get that you want.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now