Pastebin na 502.cz
Kód: Zapni.TV Zobrazeno 2484x |Zvýrazněný jazyk: Perl
#!/usr/bin/perl
# Coded by LuRy - 2011
# BadGateway.cz
use strict;
use POSIX;
use LWP::UserAgent;
use Win32::Console::ANSI qw/:all/;
use Term::ANSIColor qw(colored);
use Encode;
$nastaveni::stdoutcharset = "cp1250";
$nastaveni::barvicky = 1;
my $url = LWP::UserAgent->new();
my $tvid =0;
my $id = 0;
my $zvoleno;
my $zvoleno2;
##############################################
vypis("\t\t\t Zapni.TV - Zjištění odkazů",1,"bold green");
vypis("\t\t\t Coded by LuRy - 2011\n\n",1,"bold red");
sleep(2);
my $streamy1 = $url->get("http://zapni.tv/stat.php?id=34");
my $streamy2 = $streamy1->content;
my @streamy = ($streamy2 =~ /style='text-align:justify'><a href="play.php\?id\=(\d+)" title="(.*?)"><img align="left" style=/gi);
#print @streamy[1];
foreach my $tv(@streamy) {
my $tvid2 = $tvid + 1;
if ($tv =~ /^(\d+)$/){
$id++;
vypis($id.": ".@streamy[$tvid2]."\n");
}
$tvid++;
}
print "---------------------- \n";
vypis("Jakou televizi chces? :) [ID]: ",1,"bold green",1);
our $volba = <STDIN>;
$volba =~ s/\n//;
$tvid =0;
$id = 0;
foreach my $tv(@streamy) {
my $tvid2 = $tvid + 1;
if ($tv =~ /^(\d+)$/){
$id++;
if ($volba eq $id){
$zvoleno = "";
$zvoleno = @streamy[$tvid];
$zvoleno2 = "";
$zvoleno2 = @streamy[$tvid2];
last if ($volba eq $id);
}
}
$tvid++;
}
vypis ("Výběr: $zvoleno2 ",1,"bold blue",1);
my $streamy1 = $url->get("http://zapni.tv/play.php?id=".$zvoleno);
my $streamy2 = $streamy1->content;
my $streamurl;
my $streamtyp;
if ($streamy2 =~ /http:\/\/www.zapni.tv\/stream\/vlc_2\.php\?id=$zvoleno\&session=(.*?)\&stream=play/i){
$streamurl = "http://www.zapni.tv/stream/vlc_2.php?id=".$zvoleno."&session=".$1."&stream=play";
$streamtyp = "VLC";
} else {
if ($streamy2 =~ /<param name="url" value="stream\/wmp.php\?id=(\d+)\&heslo=(.*?)\.asx">/i){
$streamurl = 'http://www.zapni.tv/stream/wmp.php?id='.$1.'&heslo='.$2.'.asx';
$streamtyp = "WMP";
}
if ($streamy2 =~ /<param name=\'flashvars\' value=\'playlistfile=stream\/(.*?)\'>/i){
my $tmp2 = $1;
$tmp2 =~ s/\&\;/\&/;
my $tmp3 = 'http://www.zapni.tv/stream/'.$tmp2;
if ($url->get($tmp3)->content =~ /<media\:content url="(.*?)" type="video\/x-flv" \/>/i){
$streamurl = $1;
$streamtyp = "FLV";
}
}
}
if ($streamurl){
vypis ("[$streamtyp]",1,"bold magenta",0);
vypis ("Link: $streamurl",1,"bold blue",0);
} else {
vypis ("Link: není, jiný typ přehrávání",1,"bold red",0);
}
vypis("Stiskem klávesy ENTER program ukončíte...\n");
my $volba = <STDIN>;
print "Konec ...\n";
##############################################
exit;
sub vypis {
my ($testext,$colored,$color,$odradkovani) = @_;
use Encode qw(from_to);
from_to($testext,"UTF-8",$nastaveni::stdoutcharset);
if (!$odradkovani){
$testext =~ s/\n//g;
$testext = $testext;
}
if ($colored && $nastaveni::barvicky){
print colored($testext,$color);
if (!$odradkovani){
print colored("\n","white");
}
} else {
print colored($testext,"white");
if (!$odradkovani){
print colored("\n","white");
}
}
}
Copy & Paste