Solved

Use Delphi to get YouTube url (or t parameter)

Posted on 2008-06-20
4
2,457 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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