« YouTube changes crossdomain.xml ? | Main | Orkut is banned in India or Maharastra? »

December 08, 2006

YouTube support - funny response

While working on ActionScript 2.0 API for YouTube, I sent a mail to YouTube-developer-support to ask if they are planning any improvement in their API to allow us (developers) to get the FLV url without any hacks. I didn't get the response of that mail for many days. Anyways, I sent another mail informing that I implemented the same and they might want to post a link at their developer-page. They used to have links of other implementation (f.ex. fTube by Manish)

The response from their support guy is little funny, atleast I laughed first-time. Click the following image to see it.

 

I think, he might replied me instead of someone else.

Posted by Abdul Qabiz at December 8, 2006 07:40 PM

Comments

Looks like you got a canned response ;)

Posted by: Oscar Trelles at December 8, 2006 08:23 PM

It seems you have a major problem, YOU NEED TO INSTALL FLASH PLAYER!!! lol
Of course they haven't read the URL that you sent. They think that your a kinda new user. You can attach your resume for the next time... hahahaha

Posted by: Gustavo at December 8, 2006 09:17 PM

I never contacted YouTube. They just linked to my blog on their own. This was well before the Google acquisition, when they were a nice "web 2.0" company.

I did contact them afterwards to ask why they had stopped providing direct access to the FLV file. No response. But it makes sense, no? If they give access to the FLV directly, who'll visit youtube.com?

Posted by: Manish Jethani at December 8, 2006 09:22 PM

Hi,
I have write some class for get the FLV from youtube, dailymotion and google video using the url of web page.
I have an other class for find directly the good web site and FLV with a youtube, dailymotion, google video url.

You can view it on http://chloridrik.free.fr/index.php/2006/11/14/65-apres-youtube-dailymotion-et-google-video-en-as2
sorry for my english, I'm french.

Posted by: chloridrik at December 8, 2006 10:11 PM

Abdul,

Sorry to leave an unrelated comment, but I cannot find an email contact for you.

Ted Patrick said you might be able to help me with an issue I've been having with the AS3 Flickr API. I've left a post about it here: http://bcdef.org/?p=22

Posted by: Buck at December 8, 2006 10:21 PM

@Manish - I know you never contacted them, your application was quite popular and was hand-picked by YouTube guys...

They never provided direct access to flv, you have to get by parsing the page and find "t" param. You were doing the same right. They have just changed the crossdomain.xml which means you can load any RSS feeds or use their REST/XMLRPC based API using Flex/Flash without using any server-side proxy.

I believe, you can still get the FLV url using the old way.

BTW! Check out my first email to them, its attached later in this comment, I also hoped that they don't change after acquisition.

I understand the business case and also mentioned in comment in my previous post about YouTube's changes to crossdomain.


Here is my first email to them:-


Hi,

I am writing ActionScript 2.0 API for YouTube because I don't see one online. ActionScript 3.0 version is done though by Adobe guys.

I am done with entire implementation but I am just wondering how do I get the FLV URL? Right now I have to do pattern matching on entire HTML page to get the "t" param value.

It would be great if you can add support for that, may be you can figure out some way to disallow caching or content-sucking by bad guys ;)

I am sure, those who determined to hack systems would do that but you can always make things not trivial.

Please let me know if you are planning to expose an API to get FLV url. I would update my code. I would soon be posting the ActionScript 2.0 version of API on my blog http://www.abdulqabiz.com/blog/ with an example.

You might want to link it on your developer page.

Thanks for making such a great service and I am sure you got rewarded by Google acquisation, hope you guys still retain same culture and innovation and not get influenced by Google guys :)

regards

-abdul


@chloridrick - You can find out flv path of Google video from their MRSS feeds. For YouTube, you need to get "t" param that is passed in object/embed tag of their player-embed-code. Once you have video_id and t, you can construct url like this:-

http://www.youtube.com/get_video.php?video_id=&t=

This would return a FLV, so you can probably make one request from your NetStream to your server-side script, which would take video_id, get "t" by parsing YouTube's page and finally redirect to url (the one it constructed as shown above)...

I am not sure about dailymotion, have not seen this site before...

BTW! I am telling you what I learnt from others or myself. I really don't know how legal/illegal it is to get the content from Google/YouTube this way. I am not responsible for anything :), I am just sharing what I have learnt...


-abdul

Posted by: Abdul Qabiz at December 8, 2006 11:32 PM

I have a Flex / YouTube app that plays FLVs from YouTube without their player wrapped around it. This isn't new, but let me know if you want my code and I'll send it. See my email address on this post to get in touch.

Posted by: Mike Britton at December 9, 2006 09:53 AM

@Mike - Thanks, you must be using some server-side proxy or your application might be standalone?

my problem is not being able to load YouTube RSS feeds or use their REST based API. Crossdomain issue..

-abdul

Posted by: Abdul Qabiz at December 9, 2006 11:14 AM

@Abdul: No, back in March when I wrote it, YouTube did provide direct access to the FLV. They blocked it later. You can see this in the comments to my original post.

Posted by: Manish Jethani at December 10, 2006 10:48 AM

Awesome! Gotta love tech support.

This article is on the first page of the google query "indian resumes funny", by the way. ;->

Posted by: Jonathan Boutelle at December 29, 2006 01:39 PM

Hello Guys,
I am somewhat new in this field and i couldn't see from where else i could get help on a YouTube technical questions since the YouTube team is a bit slow in answering questions.
I would really appreciate any help.
I am devising a website that will you the YouTube API to search for videos by tag. The communication interface i am using is XML-RPC.
I am creating the webiste using ASP.NET and specifically C#.
I've downloaded a client site library for XML-RPC to handle all the nasty low level stuff and make my life easier. The link for the library is:
http://www.xml-rpc.net/
So my problem is that when i make a request to YouTube i get an error response back which says:

'response contains string value where struct expected [response]'

As YouTube describe you need to pass exactly on parameter of type struct which contains all the parameters of the method used. The method i want to use is: youtube.videos.list_by_tag

So i do so by:

public struct MethodParameters
{
public string dev_id;
public string tag;
}

Then i create an instance of the object and i set the values of the variables.
Then i send the object to You Tube. Everything looks fine besides the response:)

King Regards,

Alexandros

Posted by: Alessandro at January 6, 2007 12:54 AM

can anyone help me with getting the "t" param from the youtube object/embed tag, as abdul suggests above?

thanks

mark

Posted by: mark at February 11, 2007 09:59 AM

@mark- check out this entry..

http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/youtube_actionscript.php

Posted by: Abdul Qabiz at February 11, 2007 10:02 AM

Hi Abdul

thanks alot for your help, but i've still got a problem/bug.

when i do
var t:String = String (RegExp.match(new RegExp ("&t=[^&]*"), data)[0]).split ("=")[1];

i only get the last of 3 matches, and that is simply "t". if i change the regexp to &t=O ( which should work for the url i had) I get a null answer.

I thought that the [0] was refering to an array of matchs, 0 being the 1st, but its not.

can you help shed some light on this for me?

Thanks alot

mark

Posted by: mark at February 14, 2007 03:01 AM

@mark - can you please email the code you were using? My email id is [mail at abdulqabiz dot com]

I would look into it.

thanks

-abdul

Posted by: Abdul Qabiz at February 19, 2007 08:28 PM

Hi Abdul,

First of all, thanks for the code. It is really cool to be able to write your player to play youtube videos. It is really great to have you share this with us.

I am currently facing a problem. I am writing a different flash application based on your code (the one in actionscript with LoadVar, not php), and was able to extract out the "t" param.

Running from my local machine, I was able to play the youtube clip with a flv movie player component. However, upon uploading the swf and html files to the webhost (geocities), the swf could not find the html file of the youtube video to loadvar with, and thus could not find the t value.

Do you know if this is a problem with the webhost, or just some things that I have neglected? I heard from you that loadvar doesn't work on IE6 very well, so I am currently using firefox 2.0.0.2 to test it out.

Thanks
Julius

Posted by: Julius Ang at February 26, 2007 09:51 PM

@Julius - This is not problem in code and not in your webhost. It's basically Flash Player's security-sandbox which doesn't allow to load data from different domain unless that domain explicitly gives you permission through crossdomain.xml. YouTube used to give permission but due to some security issues at their end, they changed the crossdomain.xml.

You can still do things using a proxy script, but I am not sure if geocities lets you run PHP or any server-side script... You can find the PHP code on other posts on my blog regarding YouTube...

-abdul

Posted by: Abdul Qabiz at February 27, 2007 09:12 AM

Hi Abdul,

Thank you for the quick response. I think I have failed to understand that the what kind of problems that the cross domain security is creating. Thanks for explaining it to me.

I am pretty sure that geocities do not provide php support. I have switched to a my-php.net, but however, they do not support url fopen. Just as a side note, do you have any web host in mind that you know does support url fopen? Or is making my machine into a server the only way around this?

Thanks
Julius

Posted by: Julius at February 27, 2007 06:11 PM

Hi Abdul,

Sorry for the repeated post. But I think I did find a webhost (ueuo.com) that support cURL and php, and with these instead of php's file function, I have gotten the html file and the t param.

However, after getting the "t" para, I realized that I have to pass in to flash player 8 another http link inside action script player.play("http://www.youtube.com/get_video.php?video_id=" + key + "&t="+ t + "&.flv")

This will again trigger a security-sandbox error. Does this mean I can never load a flv file from a flash player?

Sorry to keep bothering you on this, but I really need a bit of help...

Thanks again,
Julius

Posted by: Julius at February 27, 2007 09:32 PM

Hi again Abdul

I posted at the begining of February and you were a huge help to me, Thanks!

However, my code no longer works. I can get the tParameter no problem, but in can no longer open the movie .flv URL.

for example

http://www.youtube.com/get_video.php?video_id=vaaWEHKpdQk&t=OEgsToPDskJSTsmz_bPf9zQXEnJLfCRO&.flv

my flash code says i can't open this URL. Has youtube changed their something again?

mark

Posted by: mark at March 26, 2007 11:41 PM

@mark

> my flash code says i can't open this URL. Has
> youtube changed their something again?

It works, I just checked using my php code. Can you please email me the code-logic you are using to get the FLV url? YouTube might have blocked your ip, not sure..let me see your code first. You can email me at [mail at abdulqabiz dot com]

Posted by: Abdul Qabiz at March 27, 2007 09:51 AM

Dear Abdul

do you know a way to get the exact filename of the flv file downloading? In PHP I tried this:

header('Content-Disposition: attachment; fname="down.flv" ');

But does not work. How do I get fname?
Any help appreciated.
Thanx.

Posted by: schnuffix at March 29, 2007 07:17 AM

@schnuffix: I believe, most of the filenames are videoid.flv. So if you know the YouTube! video_id, you can use it for filename.

Here is php code that would let you do that:-

<?php
if (isset($_GET['url']))
{
// Get page
$url = $_GET['url'];
$data = implode("", file($url));
// Get content items
if (preg_match_all("/&t=[^&]*/", $data, $matches))
{
$t = $matches[0][0];
$t = preg_split("/=/", $t);
$t = $t[1];
$v = $url;
$v = preg_split ("/\?v=/", $v);
//$v = preg_split ("/=/", $v);
$v = $v[1];
$youtubeVideoPath = "http://www.youtube.com/get_video.php?video_id=" . $v . "&t=". $t . "&.flv";
header('Content-Disposition: attachment; fname="'.$v.'".flv"');
header ("Location: $youtubeVideoPath");
}
else
{
echo "null";
}
}
else
{
echo "No YouTube URL to process";
}
?>

Posted by: Abdul Qabiz at March 29, 2007 11:45 AM

Hi Abdul,

thank you for help but it still doesnt work. The code ist fine but does not get the correct filename.

As far as I know $fname has to be the filename including path of the flv on the correct server e.g.

http://chi-v82.chi.youtube.com/

For filename I tried &t= hoping this is the script that gives me the correct filename, but does not work. videoid.flv does not work for me.

I grabbed the server name out of http headers with Fiddler (HTTP sniffer for Internet Explorer). Seems to be the right server name but the filename ist unknown.

Knowing $fname one can set the suggested download name with header as you did:

header('Content-Disposition: attachment; fname="down.flv" ');

In this case the name of the file is down.flv. If you don't define $fname the correct way, the browser does not know what to do with it.

Did you manage to get the correct filename in your applications?

Posted by: schnuffix at March 29, 2007 07:13 PM

@schnuffix : Without header ('Content-Disposition: ..), I used to get see get_video as filename. But with header ('Content-Disposition: ..'), I can see .flv in file download box.

What do you see?

-abdul

Posted by: Abdul Qabiz at March 29, 2007 07:24 PM

I see the name of the script: get_video. I played around and sometimes I got $id.flv but Content-Disposition header is never used. I think $fname is wrong or something other is missing. Dont know.

Posted by: schnuffix at March 29, 2007 08:01 PM

get rid of that old dial up connection man!!! what's wrong with you.??

Posted by: Doon Rothmani at May 2, 2007 04:44 AM

Y TO TAKE THAT MUCH OF TROUBLE TO DOWNLOAD VIDEOS FROM YOUTUBE
GO TO KEEPVIDS.COM AND COPY THE DESIRED YOUTUBE LINK AND PASTE THERE YOU WILL NEED A VLC PLAYER FOR THAT OR CONVERT IT TO YOUR DESIRED FORMAT USING ANY CONVERTER

Posted by: SATYARCH at May 24, 2007 02:54 PM

@Doon
I believe their purpose is to make an application that able to get videos from youtube. So keepvid is not the answer.

@someone else
By the way, I have an idea using Youtube's api for my website, but apparently many people has done this long before me.
I wonder if any of the developers has been blocked by youtube since I think it's illegal? (if you read Youtube's faq, it's clearly shows that they don't like their videos being downloaded)

Posted by: ChrisFreak at June 9, 2007 11:42 PM

Sorry for double post. It was meant for satyarch :P

Posted by: ChrisFreak at June 9, 2007 11:44 PM

The dude didn't reply to the wrong mail. It was just an automated response. It would be extremely difficult to get any actual response from youtube. Almost no matter what you write, you will keep getting an automatic response, that usually has nothing to do with what you are asking about. I spend many months trying to let them know about a bug on their site. I kept getting automated answers that had nothing to do with the subject, despite that I used a mailform that was given to me when the bug occured, and it asked me to submit it using that mailfrom and include some code that it also provided. That's how it goes.

Posted by: Diibu at June 12, 2007 10:36 AM

How to get .flv url from daily motion?any idaea? please help me..........!Thanku in advance.

Posted by: amol at January 18, 2008 01:48 PM

@amol: I think, I did write some code to get dailymotion flv, I need to check if it still works and I would post here or new blog entry..

-abdul

Posted by: Abdul Qabiz at January 18, 2008 04:44 PM

Plz waiting for your blog "code to get dailymotion flv" or send me code.thank u for your response.

Posted by: amol at January 21, 2008 07:20 PM

Hello,

It would be very interesting to se what it is possible to do with Dailymotion. Can't wait to see it :)

Posted by: bretac at January 22, 2008 03:10 AM

@amol, bretac: Check out http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/getting_dailymotion.php

I have posted about dailymotion :-)

-abdul

Posted by: Abdul Qabiz at January 22, 2008 11:04 AM

Post a comment




Remember Me?


Please enter the security code you see here

(you may use HTML tags for style)