Youtube links

pho's picture

Hi,

I need to play youtube videos in quartz composer.

From a link like this http://www.youtube.com/watch?v=VQm5gNo-5Vo, via a firefox plugin, I can get a playable video link like this

http://o-o.preferred.lis01s03.v2.lscache7.c.youtube.com/videoplayback?sp...

The problem is that this link expires quickly, so I need to generate a new link every time I play the video. Is it possible?

I think most plugins use javascript to retrieve the links.

I also looked at the page source code and I found a link that looks like the video one under img src, but I couldn't play it in quartz.

PreviewAttachmentSize
youtube_player.qtz3.49 KB

Scratchpole's picture
Re: Youtube links

How about using v002 screen capture?

.lov.'s picture
Re: Youtube links

Or give a chance to CoGeWebKit ;)

pho's picture
Re: Youtube links

Cogewebkit isn't working with youtube. And even if it did, it always shows the player's buttons and youtube ads on the top of the videos. Also, it always plays audio, and I don't want that.

I also can't use screen capture because I need to play many videos automatically.

PreviewAttachmentSize
webkit test.qtz2.52 KB

pho's picture
Re: Youtube links

Webkit worked with this javascript http://userscripts.org/scripts/show/96980

You have to switch re-execute javascript, but it often crashes quartz composer.

If I had any javascript that could solve the playback issue, remove the player's scrubber and ads, and mute the video, it would be perfect :)

Still, I can just crop the bottom part of the video, so the priorities are solving the playback issue without crashing quartz and mute the video.

PreviewAttachmentSize
webplayer.qtz3.59 KB

pho's picture
Re: Youtube links

So I found this python script: http://rg3.github.com/youtube-dl/

I thought it would be easy to run it with the command line tool but I couldn't.

It worked perfectly with this command in terminal: /Users/Me/Documents/python/youtube-dl.py -g http://www.youtube.com/watch?v=ZYffV7qhvT

Scratchpole's picture
Re: Youtube links

Why do you need to play them from youtube? Could you download them or get the originals?

gtoledo3's picture
Re: Youtube links

I'm agreeing with joe; it seems to be making a lot of extra work, but maybe that's part of the requirement somehow.

Anyway, all you have to do to play a movie from youtube, without sound, is have a codec that decodes flv for Quicktime installed (I think Perian will do that).

Then, you place the source url of the movie, in the url/file input of a movie player patch. Very easy. I'm not sure the best way for automatically finding the urls of movies on youtube, but they can be easily found by "viewing source" of the page and looking for the url of the largest file that's downloading.

Whether or not you choose asynchronous mode (movie player settings) will control if it plays back with sound or not.

Again, this will only work if you have an flv converter for quicktime installed, and have an internet connection.

PreviewAttachmentSize
playing back a youtube video.qtz4.72 KB

cybero's picture
Re: Youtube links

Funnily enough this is the first exemplar posting you've made that doesn't work for me in either Lion or Snow, GT.

I do have Perian installed on both OS BTW.

I couldn't load the YouTube video in the browser using the URL you supplied , whilst finding that this sort of URL

[http://o-o.preferred.lhr07s13.v1.lscache3.c.youtube.com/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Csource%2Calgorithm%2Cburst%2Cfactor%2Ccp&fexp=909519%2C905228%2C904442%2C910014%2C916201&algorithm=throttle-factor&itag=34&ip=86.0.0.0&burst=40&sver=3&signature=7DA90F27DAB445C501D7EA93B68A98159306C6BE.C912F897F9610B78B4952D70ED8405287ADAF2E7&source=youtube&expire=1324362845&key=yt1&ipbits=8&factor=1.25&cp=U0hRSVNRUF9JT0NOMV9LS1RJOndYOVhKVGJudm5K&id=80f2fe12950d7fd3]

  • yes that long - does work in the browser [using your tip to look in the Activity window of Safari].

Still doesn't load in Lion in your composition though, but that's no doubt to do with the Movie Importer patch difficulties I've previously reported here and elsewhere [Apple Dev & Bug Reporter]. Haven't tried that URL I posted above in your posted composition in Snow, so I wonder if its your use of a cached URL [http://v7.cache4.c.youtube.com/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Csource%2Cratebypass%2Ccp&fexp=903309%2C907204%2C901700%2C910206&itag=34&ip=173.0.0.0&signature=6FDB30664E652FD220E5602FDB8EA5D405E02E65.596D8A0664742F3D25073F143FCCB07C37DD8287&sver=3&ratebypass=yes&source=youtube&expire=1324348275&key=yt1&ipbits=8&cp=U0hRSVNPVl9MT0NOMV9LSVpDOnZxOHNvLXQ3aG5k&id=c5248379eb1452c5&redirect_counter=1]that's been part of the problem I experienced.

Actually - correction, I've just taken another look and YouTube's URL mechanism won't accept the URL posted above today. Would have posted about this earlier, but Kineme's site was down for me until a couple of hours ago.

Back to the YouTube URL mechanism - clever and ephemeral.

Now I do see broadly speaking how to begin to capture only the YouTube flv video. It also looks like way too much hard work to do without being paid for it, or being especially interested in exploiting YouTube's free services, as there's a lot of intervening scripting to negotiate and either replicate or satisfy.

To be honest, I'm with Joe on this one, more or less.

I'd post the YouTube video original sources [& not necessarily in .flv format neither unless that was the only format available], to a web directory and use a simple XML playlist to load in the movies within QC . From my situation in Lion, I wouldn't use QC 4.5, but run such an installation from within QC 4.0 in Snow.

If only YouTube allowed for the use of simpler & irrevocably consistent URLs like vimeo, which alternate streaming hosting provider does allow for the same specific URL for a video and yet still disallows others, if you so wish, from downloading one's video work.

pho's picture
Re: Youtube links

I discovered that it isn't that hard after after all. I just installed youtube-dl.py and executed the -g command with an ordinary youtube url and it returned the right link. I just set the command line path to /bin/youtube.py and added argument 1 "-g" and argument 2 "youtube URL".

The idea is to have a CSV file that anyone can fill out. One of the parameters is the youtube link. The videos will then be periodically played when adequate.

It also became necessary to include vimeo links now. Unfortunately, the script returns unusable links. I'm still trying to figure that one out.

cybero's picture
Re: Youtube links

Your vimeo links should [could] just be hard wired in on an XML file IMHO. Are the links returned via the script for YouTube good for more than one day?

Correction Actually - rethink that - vimeo probably needs the same more complex approach as previously advised for YouTube , even if you snag the source video URL, as neither YouTube or Vimeo URLs are likely to give you URLs you can hardwire with more than a day's worth of use IMETD.

Are you sure those snagged YouTube file URLs are going to remain the same, it looks very much like the sort of URL I found didn't stay live for too long ?

Still, that said, I suppose one could snag the URLs with a script that were active during the day of installation.

Vimeo URLs remain inconstant in the same way.

If you make the file downloadable and only viewable were you want it be viewed you can snag the .mp4 URL, rather than negotiate the Vimeo API, which API is pretty well documented on their site BTW].

The thing is a YouYube URL like

http://youtu.be/MN0tW0qKowI

will always load but a YouTube asset URL like

http://o-o.preferred.lhr14s11.v19.lscache5.c.youtube.com/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%
2Csource%2Calgorithm%2Cburst%2Cfactor%2Ccp&fexp=909519%2C905228%2C904442%2C910014%2C916201&algorithm=throttle-factor&
itag=34&ip=86.0.0.0&burst=40&sver=3&signature=6A3FF5D9885804BE066C93608BF3D0A5951432EA.
CD88B89F0720331875F496627B26AA0A337CD343&source=youtube&expire=1324674066&key=yt1&ipbits=8&factor=1.25&cp=
U0hRSVZSUl9LUENOMV9OTFZBOnhYOVhKV2NwbnBL&id=30dd2d5b4a8aa302

which is the one I can snag from a browser's activity window or from the output from the Python script, has an expiry date. I found that this particular type of URL failed to load a day after I'd used it. Could just have been a fluke, so do tell us the good news if I'm jumping to conclusions.

It seems still to me that if those snagged long URLs are so ephemeral, then a slightly more complex approach is called for, one that ensures that the URL isn't hard coded into a CSV or XML, as these require a reliable URL.

All this ephemeral file pathing is part and parcel of these media suppliers ways of being as secure as possible.

In fact, come to think of it, why not just go to http://saveyoutube.com and download the files you need to present and run them locally ?

gtoledo3's picture
Re: Youtube links

I think you're right about the url's expiring. One probably needs to load the unchanging main url, parse through page source to find the temporary url, and then load that.

cybero's picture
Re: Youtube links

One thing that really makes me laugh is the way YouTube is becoming its own archive, littered with how to do YouTube hack videos based upon experientially acquired knowledge that is now rendered redundant due to the way in which scripting and underlying technologies are changing,