Solved

Use Delphi to get YouTube url (or t parameter)

Posted on 2008-06-20
4
2,475 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

696 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