Last active
December 18, 2015 11:58
-
-
Save ifnull/5779028 to your computer and use it in GitHub Desktop.
FlashVideo::Site:: module for get-flash-videos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Part of get-flash-videos. See get_flash_videos for copyright. | |
package FlashVideo::Site::T3licensing; | |
use strict; | |
use FlashVideo::Utils; | |
sub find_video { | |
my ($self, $browser, $embed_url) = @_; | |
my $metadata = { }; | |
my @url = ($browser->uri->as_string =~ /^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/); | |
my @rtmpdump_commands; | |
$metadata->{id} = substr($url[5], 0 , -3); | |
$metadata->{token} = ($browser->content =~ /token:(\d+)/i)[0]; | |
$metadata->{title} = substr(($browser->content =~ /<title>(.*?)<\//)[0], 0, -11); | |
$metadata->{pp1} = substr($metadata->{id}, 0, 3); | |
$metadata->{pp2} = substr($metadata->{id}, 3, 3); | |
$metadata->{pp3} = substr($metadata->{id}, 6, 1); | |
$metadata->{video_format} = ($browser->content =~ /flashVars\.format = ["'](.*?)["']/)[0]; | |
$metadata->{playpath} = "tem/warehouse/$metadata->{pp1}/$metadata->{pp2}/$metadata->{pp3}/$metadata->{id}_lp"; | |
if($metadata->{video_format} eq 'f4v'){ | |
$metadata->{playpath} = "mp4:/$metadata->{playpath}.f4v"; | |
} else { | |
$metadata->{video_format} = 'flv'; | |
} | |
$metadata->{filename} = title_to_filename($metadata->{title}, $metadata->{video_format}); | |
debug $metadata->{title}; | |
debug $metadata->{video_format}; | |
debug $metadata->{id}; | |
debug $metadata->{pp1}; | |
debug $metadata->{pp2}; | |
debug $metadata->{pp3}; | |
debug $metadata->{playpath}; | |
debug $metadata->{filename}; | |
push @rtmpdump_commands, { | |
host => "cp111580.edgefcs.net", | |
port => "1935", | |
protocol => 2, | |
tcUrl => "rtmpe://cp111580.edgefcs.net/ondemand", | |
app => "ondemand", | |
swfVfy => "http://www.t3licensing.com/video/etc/TePlayer.swf", | |
pageUrl => $embed_url, | |
playpath => "$metadata->{playpath}", | |
quiet => '', | |
flv => $metadata->{filename} | |
}; | |
return \@rtmpdump_commands; | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment