Skip to content

Commit

Permalink
Add support for Tou.tv (thanks Stavr0).
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurvideo committed Apr 3, 2010
1 parent 9551882 commit 8c66052
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
96 changes: 96 additions & 0 deletions FlashVideo/Site/Tou.pm
@@ -0,0 +1,96 @@
# Part of get-flash-videos. See get_flash_videos for copyright.
# tou.tv
#
# Reverse-engineering details at http://store-it.appspot.com/tou/tou.html
# by Sylvain Fourmanoit
#
# un grand merci a Sylvain qui a tout debrousaille!
#
# Stavr0
#
package FlashVideo::Site::Tou;

use strict;
use FlashVideo::Utils;
use URI::Escape;

sub find_video {
my ($self, $browser) = @_;

# Get the video ID
# on cherche: ,"pid":"45Kr9K8SfwVF1Q5anv7TrRpWa6nMtkG4",
my $video_id;
if ($browser->content =~ /,"pid":"(\w+)"/) {
$video_id = $1;
}
debug "Video ID = " . $video_id;

die "Couldn't find TOU.TV video ID" unless $video_id;

# on cherche: ,"titleId":"2010-03-29_CA_0052"
my $filename;
if ($browser->content =~ /,"titleId":"([^"]+)"/) {
$filename = $1 ;
}
debug "Filename = " . $filename;

# On va chercher le XML qui contient le lien RTMP
#
$browser->get("http://release.theplatform.com/content.select?pid=$video_id");

die "Couldn't download TOU.TV XML: " . $browser->response->status_line
if !$browser->success;

# on cherche: rtmp://medias-flash.tou.tv/ondemand/?auth=daEdwc5 etc...52_hr.mov
my $url;
if ($browser->content =~ /(rtmp:[^\<]+)/) {
$url = uri_unescape($1);
}
debug "URL = " . $url;

# on cherche: auth=daEdrbRdbbtcYbUb3bQbzacdOaIbNczbva9-blS.uA-cOW-9rqBvkLqxBB
my $auth;
if ($url =~ /auth=([^&]+)/ ) {
$auth = uri_unescape($1);
}
debug "AUTH = " . $auth;

# on decoupe a partir de 'ondemand/'
my $app;
if ($url =~ /(ondemand\/.+)/ ) {
$app = uri_unescape($1);
}
debug "APP = " . $app;

# on decoupe apres <break>
my $playpath;
if ($url =~ /&lt;break&gt;(.+)/ ) {
$playpath = uri_unescape($1);
}
debug "PLAYPATH = " . $playpath;

# et ca donne....
#
# rtmpdump.exe
# --app ondemand/?auth=daEcCamaRcPbCczdabkaRdkbSa8b8aec7bl-blS.4u-cOW-aqpyxlDpFCA&aifp=v0001&slist=002/MOV/HR/2010-03-29_CA_0052_hr;002/MOV/MR/2010-03-29_CA_0052_mr;002/MOV/BR/2010-03-29_CA_0052_br
# --flashVer WIN 10,0,22,87
# --swfVfy http://static.tou.tv/lib/ThePlatform/4.1.2/swf/flvPlayer.swf
# --auth daEcCamaRcPbCczdabkaRdkbSa8b8aec7bl-blS.4u-cOW-aqpyxlDpFCA
# --tcUrl rtmp://medias-flash.tou.tv/ondemand/?auth=daEcCamaRcPbCczdabkaRdkbSa8b8aec7bl-blS.4u-cOW-aqpyxlDpFCA&aifp=v0001&slist=002/MOV/HR/2010-03-29_CA_0052_hr;002/MOV/MR/2010-03-29_CA_0052_mr;002/MOV/BR/2010-03-29_CA_0052_br
# --rtmp rtmp://medias-flash.tou.tv/ondemand/?auth=daEcCamaRcPbCczdabkaRdkbSa8b8aec7bl-blS.4u-cOW-aqpyxlDpFCA&aifp=v0001&slist=002/MOV/HR/2010-03-29_CA_0052_hr;002/MOV/MR/2010-03-29_CA_0052_mr;002/MOV/BR/2010-03-29_CA_0052_br
# --playpath mp4:002/MOV/HR/2010-03-29_CA_0052_hr.mov
# -o 2010-03-29_CA_0052_hr.flv

return {
app => $app,
pageUrl => $url,
swfUrl => "http://static.tou.tv/lib/ThePlatform/4.1.2/swf/flvPlayer.swf",
tcUrl => $url,
auth => $auth,
rtmp => $url,
playpath => $playpath,
flv => "$filename.flv",
};
}

1;
4 changes: 4 additions & 0 deletions t/urls
Expand Up @@ -27,6 +27,7 @@ http://www.slashfilm.com/2009/07/03/ong-bak-2-movie-trailer-tony-jaa-vs-a-real-a

# eHow
http://www.ehow.com/video_2275993_eat-rattlesnake.html
http://www.ehow.com/video_5706704_do-correctly-rack-pool-balls_.html

# Nicovideo
http://www.sankakucomplex.com/charts/niconico/player.php?vid=sm6572679
Expand Down Expand Up @@ -161,6 +162,9 @@ http://www.ima.umn.edu/videos/?id=4
# MIT
http://mitworld.mit.edu/video/33

# Tou.tv
http://www.tou.tv/en-audition-avec-simon/S01E07

## Generic

# Creativity-online - link expired
Expand Down

0 comments on commit 8c66052

Please sign in to comment.