Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'The script works, sort of' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
The script works, sort of
Authored by: ash7 on May 04, '05 05:56:16PM
You have to right-click (or control-click) on the image thumbnails while browsing the music videos to the the "Copy iTunes Music Store URL" option. That's the screen you see immediately after clicking "Music Videos" on the iTMS homepage. After you get the URL and run it through the script, you'll end up with a Safari window playing the movie. To save it, I used wget on the URL of the movie. QT7 Pro may work, I wouldn't know.

UNIX Geek Warning: The Following Is For Command Line Geeks Only

If you have wget, gzip, and mktemp (I have Fink installed), the following perl script I wrote will work. I saved mine as "GetMovie.pl", so to run it, you have to type:

./GetMovie.pl "http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewVideo?b=a&videoId=930930"
The URL has to be in quotes.

#!/usr/bin/perl

use IO::Socket::INET;
$in_string = $ARGV[0];
if ( $in_string =~ /videoId=(\d+)/gi ) {
	$vid = $1;
} else {
	print "Given URL was invalid"; exit;
}

$socket = IO::Socket::INET->new("ax.phobos.apple.com.edgesuite.net:80") or die "Couldn't create socket";

print $socket "GET /WebObjects/MZStore.woa/wa/viewVideo?b=a&videoId=".$vid."&videoIndex=2 HTTP/1.0\r\nHost: ax.phobos.apple.com.edgesuite.net\r\nUser-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.1 (KHTML, like Gecko)\r\nAccept-Encoding: gzip\r\n\r\n";

while ( $line = <$socket> ) {
	$line =~ s/[\r\n]//gi;
	if ( $line =~ /^Content-Length: (\d+)/gi ) {
		$clen = $1;
	} elsif ($line eq "") {
		last;
	}
}

binmode($socket);read($socket,$gz_content,$clen);close $socket;

$temp_name = `mktemp`;
open(TEMP, ">$temp_name") or die "Unable to save gzip data to temp file";
binmode(TEMP);print TEMP $gz_content;close(TEMP);

$gz_output = `gunzip -d -c $temp_name`;
`rm $temp_name`;

$gz_output =~ /<MovieView(.*?) url=\"(.*?)\">/;
$mv_attr = $2;
$gz_output =~ /songName<\/key><string>(.*?)<\/string>/;
$movie_title = $1;
$gz_output =~ /playlistArtistName<\/key><string>(.*?)<\/string>/;
$movie_artist = $1;

$f_cmd = "wget -O \"$movie_artist - $movie_title.mov\" $mv_attr\n";

exec $f_cmd;


[ Reply to This | # ]