SVN: toys/rsget.pl/Video/TV3Play

glen glen at pld-linux.org
Sun Dec 1 00:07:24 CET 2013


Author: glen
Date: Sun Dec  1 00:07:23 2013
New Revision: 12734

Added:
   toys/rsget.pl/Video/TV3Play
Log:
download from tv3play


Added: toys/rsget.pl/Video/TV3Play
==============================================================================
--- (empty file)
+++ toys/rsget.pl/Video/TV3Play	Sun Dec  1 00:07:23 2013
@@ -0,0 +1,63 @@
+# $Id: Delfi 12105 2011-02-03 09:44:17Z glen $
+# Video::TV3 - Video getter plugin for rsget.pl
+#
+# 2013 (c) Elan Ruusamäe <glen at pld-linux.org>
+#		This program is free software,
+# you may distribute it under GPL v2 or newer.
+
+name: TV3Play
+short: V:TV3Play
+web: "http://tv3.ee/"
+uri: qr{www.tv3play.(?:ee|se)/play/\d+}
+# limit slots bacause rtmp support is very bad
+slots: 3
+status: OK 2013-11-30
+
+start:
+	GET( $-{_uri} );
+
+	! m{<meta property="og:title" content="([^"]+)" />};
+	my $title = $1;
+	$-{file_name} = de_ml($title);
+	$-{file_name} =~ s{/}{_}g;
+
+	! m#var flashVars = {(.+?)};#s;
+	my $flashVars = $1;
+	! $flashVars =~ m{id:(\d+)};
+	my $videoId = $1;
+
+	$-{api_uri} = "http://viastream.viasat.tv/PlayProduct/$videoId";
+
+	GET($-{api_uri}, keep_referer => 1 );
+
+	# TODO: include into filename:
+	#<BroadcastDate>20131015</BroadcastDate>
+	#<BroadcastTime>1930</BroadcastTime>
+
+	# <Videos>
+	#  <Video>
+	#   <Title><![CDATA[Medium quality]]></Title>
+	#   <BitRate>800</BitRate>
+	#   <FormatID>1</FormatID>
+	#   <Url><![CDATA[rtmp://...:1935/PATH/mp4:....mp4]]></Url>
+	#  </Video>
+	# </Videos>
+	! m{<Videos>(.+)</Videos>}s;
+
+	# handle just first video. for now
+	! $1 =~ m{<Video>(.+)</Video>}s;
+	! $1 =~ m{<Url><!\[CDATA\[(.+)\]\]></Url>}s;
+	my $url = $1;
+
+	ERROR( "no streams found" ) unless $url;
+
+	my ($server, $playpath) = $url =~ m{^(\w+://[^/]+(?::\d+)?/[^/]+)/(.+)$};
+	my ($ext) = $playpath =~ /\.([^.]+)$/;
+	$-{file_name} .= ".$ext";
+
+	$-{file_uri} = "$server playpath=$playpath";
+
+	INFO(name => $-{file_name}, quality => $ext);
+	DOWNLOAD($-{file_uri}, fname => $-{file_name});
+
+# vim: filetype=perl:ts=4:sw=4


More information about the pld-cvs-commit mailing list