From aa88cac849b6bfb35de6f6a5bdc305228ab6855b Mon Sep 17 00:00:00 2001 From: Debdut Karmakar Date: Sat, 12 Aug 2017 19:51:54 -0400 Subject: [PATCH] First Commit --- LICENCE | 19 ++ README.txt | 15 ++ hotstarlivestreamer.php | 212 +++++++++++++++++++++++ hotstarlivestreamer.sh | 21 +++ starsportslivestreamer.php | 113 ++++++++++++ starsportslivestreamer.sh | 11 ++ test-without-vpn-hotstarlivestreamer.bat | 19 ++ test-without-vpn-hotstarlivestreamer.php | 212 +++++++++++++++++++++++ voot.php | 59 +++++++ vootffmpeg.bat | 11 ++ vootffmpeg.php | 58 +++++++ vootffmpeg.sh | 12 ++ vootlivestreamer.sh | 15 ++ 13 files changed, 777 insertions(+) create mode 100644 LICENCE create mode 100644 README.txt create mode 100644 hotstarlivestreamer.php create mode 100755 hotstarlivestreamer.sh create mode 100644 starsportslivestreamer.php create mode 100644 starsportslivestreamer.sh create mode 100644 test-without-vpn-hotstarlivestreamer.bat create mode 100644 test-without-vpn-hotstarlivestreamer.php create mode 100644 voot.php create mode 100644 vootffmpeg.bat create mode 100644 vootffmpeg.php create mode 100644 vootffmpeg.sh create mode 100644 vootlivestreamer.sh diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..93931fa --- /dev/null +++ b/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Debdut + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..2979503 --- /dev/null +++ b/README.txt @@ -0,0 +1,15 @@ +#### hotstarlivestreamer #### and #### starsportslivesreamer #### + +##linux + +first you can delete tools folder and hotstarlivestreamer.bat and starsportslivesreamer.bat it's for windows users + +Dependencies livestreamer and PHP + +run hotstarlivestreamer.sh or starsportslivesreamer.sh in terminal + +./hotstarlivestreamer.sh or ./starsportslivesreamer.sh + +and follow the instructions + +by default the videos are downloaded in videos/ diff --git a/hotstarlivestreamer.php b/hotstarlivestreamer.php new file mode 100644 index 0000000..c9a8777 --- /dev/null +++ b/hotstarlivestreamer.php @@ -0,0 +1,212 @@ + array('user_agent' => 'custom user agent string')); + + $context = stream_context_create($options); + + $showc = file_get_contents($collec, false, $context); + + $resultObj=json_decode($showc)->resultObj; + + $contentInfo=$resultObj->{'contentInfo'}; + + $contentInfo2=($contentInfo[0]); + + $realpidc = $contentInfo2->categoryId; + + $collecs="http://account.hotstar.com/AVS/besc?action=GetArrayContentList&categoryId=$realpidc&channel=PCTV"; + + $showcs = file_get_contents($collecs, false, $context); + + $resultObjs=json_decode($showcs)->resultObj; + + $contentList=$resultObjs->{'contentList'}; + + if(isset($argv[2])){ + + $title="http://account.hotstar.com/AVS/besc?action=GetAggregatedContentDetails&channel=PCTV&contentId=$argv[2]"; + + $show = file_get_contents($title, false, $context); + + $resultObj=json_decode($show)->resultObj; + + $contentInfo=$resultObj->{'contentInfo'}; + + $contentInfo2=($contentInfo[0]); + + $contentTitle = $contentInfo2->contentTitle; $contentTitle=str_replace(" ","-",$contentTitle); + + $episodeTitle = $contentInfo2->episodeTitle; $episodeTitle=str_replace(" ","-",$episodeTitle); + + $episodeNumber= $contentInfo2->episodeNumber; $episodeNumber="episode$episodeNumber"; + + $filename= "'$contentTitle'_'$episodeNumber'_'$episodeTitle'"; + + $filename=iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $filename); + + $filename = preg_replace('/[^A-Za-z0-9_\. -]/', '', $filename); + + $json="http://getcdn.hotstar.com/AVS/besc?action=GetCDN&asJson=Y&channel=TABLET&id=$argv[2]&type=VOD"; + + $test=file_get_contents($json, false, $context); + + $obj=json_decode($test)->resultObj; + + $hls=$obj->{'src'}; + + $testhttps=strpos($hls, 'https'); + + if($testhttps){ + $m3u8p=str_replace("https","hlsvariant://https",$hls); + } + else{ + $m3u8p=str_replace("http","hlsvariant://http",$hls); + } + + $m3u8=str_replace("2000,_STAR.","2000,3000,4500,_STAR.",$m3u8p); + + $badformat = array("4500","3000","2000","1300","800","400","180","106","54","16"); + + $googformat = array("1080p", "900p","720p","404p","360p","234p","","","",""); + + $quality = str_replace($badformat, $googformat, $m3u8); + + $endq= strrpos($quality, ','); $beginq= strpos($quality, ','); $endrq = $endq - $beginq ; + $bitrate= substr($quality, $beginq , $endrq); $bitrate=str_replace(","," ",$bitrate); + + if(isset($argv[3])){ + } + else{ + echo "Available streams: $bitrate\n"; + } + + } + else{ + foreach($contentList as $r){ + echo "Id:".$r->contentId." "."episodeTitle:".$r->episodeTitle." "."contentTitle:".$r->contentTitle."\n"; + } + } + if(isset($argv[3]) AND isset($argv[2])){ + + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[5]livestreamer \"$m3u8\" \"$argv[3]\" -o \"$argv[4]$filename.ts\" &"); + echo "Done.\n"; + } + else{ + } + +} +else{ + + $folder = ""; + + $ppid= strrpos($argv[1], '/'); + + $id = substr($argv[1], $ppid); + + $pid=str_replace("/","",$id); + $pid = substr($pid, -10); + + $title="http://account.hotstar.com/AVS/besc?action=GetAggregatedContentDetails&channel=PCTV&contentId=$pid"; + + $json="http://getcdn.hotstar.com/AVS/besc?action=GetCDN&asJson=Y&channel=TABLET&id=$pid&type=VOD"; + + $options = array('http' => array('user_agent' => 'custom user agent string')); + + $context = stream_context_create($options); + + $show = file_get_contents($title, false, $context); + + $resultObj=json_decode($show)->resultObj; + + $contentInfo=$resultObj->{'contentInfo'}; + + $contentInfo2=($contentInfo[0]); + + $contentTitle = $contentInfo2->contentTitle; $contentTitle=str_replace(" ","-",$contentTitle); + + $episodeTitle = $contentInfo2->episodeTitle; $episodeTitle=str_replace(" ","-",$episodeTitle); + + $episodeNumber= $contentInfo2->episodeNumber; $episodeNumber="episode$episodeNumber"; + + $filename= "'$contentTitle'_'$episodeNumber'_'$episodeTitle'"; + + $filename=iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $filename); + + $filename = preg_replace('/[^A-Za-z0-9_\. -]/', '', $filename); + + $test=file_get_contents($json, false, $context); + + $obj=json_decode($test)->resultObj; + + $hls=$obj->{'src'}; + + $testhttps=strpos($hls, 'https'); + + if($testhttps){ + $m3u8p=str_replace("https","hlsvariant://https",$hls); + + } + else{ + $m3u8p=str_replace("http","hlsvariant://http",$hls); + } + $testhttps2=strpos($m3u8p, 'https'); + if($testhttps2){ + $m3u8=str_replace("2000,_STAR.","2000,3000,4500,_STAR.",$m3u8p); + + } + else{ + $m3u8=str_replace("2000,_STAR.","2000,_STAR.",$m3u8p); + } + + + + + $badformat = array("4500","3000","2000","1300","800","400","180","106","54","16"); + + $googformat = array("1080p", "900p","720p","404p","360p","234p","","","",""); + + $quality = str_replace($badformat, $googformat, $m3u8); + + $endq= strrpos($quality, ','); $beginq= strpos($quality, ','); $endrq = $endq - $beginq ; + $bitrate= substr($quality, $beginq , $endrq); + + $bitrate=str_replace(","," ",$bitrate); + + + if(isset($argv[2])){ + if(isset($argv[2]) AND ($argv[5]=='d')){ + + + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[4]livestreamer \"$m3u8\" \"$argv[2]\" -o \"$argv[3]$filename.ts\" &"); + echo "Done.\n"; + } + else{ + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[4]livestreamer \"$m3u8\" \"$argv[2]\" &"); + echo "Done.\n"; + } + } + else{ echo "Available streams: $bitrate\n"; + } + + + +} + +?> diff --git a/hotstarlivestreamer.sh b/hotstarlivestreamer.sh new file mode 100755 index 0000000..e0fc3c7 --- /dev/null +++ b/hotstarlivestreamer.sh @@ -0,0 +1,21 @@ +#/bin/bash +echo "paste the link" +read link +last=${link: -1} +folder=$PWD/videos/ +livestreamer="" +php hotstarlivestreamer.php "$link" +if [[ "$last" = "c" ]] +then echo "enter the Id of the video (example write 1000021386)" +read id +php hotstarlivestreamer.php "$link" "$id" +echo "write quality (example write 720p)" +read quality +php hotstarlivestreamer.php "$link" "$id" "$quality" "$folder" "$livestreamer" +else +echo "write quality (example write 720p)" +read quality +echo "play or download? (write p or d)" +read choice +php hotstarlivestreamer.php "$link" "$quality" "$folder" "$livestreamer" "$choice" +fi diff --git a/starsportslivestreamer.php b/starsportslivestreamer.php new file mode 100644 index 0000000..f8c0912 --- /dev/null +++ b/starsportslivestreamer.php @@ -0,0 +1,113 @@ + array('user_agent' => 'custom user agent string')); + +$context = stream_context_create($options); + +$testlink=strpos($argv[1], '/vod/'); +$testlink2=strpos($argv[1], '/live-video'); +$testlink3=substr("$argv[1]", -1); +if($testlink){ + goto yesvod; + } + else{ + goto novod; + } + +yesvod: +$prepidb= strpos($argv[1], 'video='); $prepide=strrpos($argv[1], '/'); $prepidef = $prepide - $prepidb ; +$prepid= substr($argv[1], $prepidb , $prepidef); $pid=str_replace("video=","",$prepid); +$json="http://m.starsports.com/syndicationdata/newmobile/video/video_details/$pid.json"; +$showc = file_get_contents($json, false, $context); +$Video=json_decode($showc)->Video; +$pid=$Video->{'VideoId'}; +goto endtest; + + + +novod: +if($testlink2){ + goto yeslive; + } + else{ + goto nolive; + } +goto endtest; + +yeslive: +$prepids=str_replace("/live-video","",$argv[1]); +$pid=substr("$prepids", -6); +$json="http://matchcentre.starsports.com/syndicationdata/newmobile/sportswire/cricket/match/$pid/videolist.json"; +$showc = file_get_contents($json, false, $context); +$prepide= strpos($showc, 'Replay'); $prepidb=$prepide - 150; $prepidef = $prepide - $prepidb ; +$prepid= substr($showc, $prepidb , $prepidef); +$prepidb= strpos($prepid, '"VideoId": "'); $prepide=$prepidb + 19; $prepidef = $prepide - $prepidb ; +$prepid= substr($prepid, $prepidb , $prepidef); $pid = str_replace('"VideoId": "',"",$prepid); +goto endtest; + + +nolive: +if (eregi("^[0-9]",$testlink3)){ + goto yesnumber; + } + else{ + goto nonumber; + } +goto endtest; + + +yesnumber: +$prepid = substr($argv[1], strrpos($argv[1], "-")); +$pid = str_replace("-","",$prepid); +goto endtest; + +nonumber: +goto allno; + +allno: +$prepidb= strpos($argv[1], 'video='); $prepide=strrpos($argv[1], '/'); $prepidef = $prepide - $prepidb ; +$prepid= substr($argv[1], $prepidb , $prepidef); $pid=str_replace("video=","",$prepid); +$json="http://m.starsports.com/syndicationdata/newmobile/video/video_details/$pid.json"; +$showc = file_get_contents($json, false, $context); +$Video=json_decode($showc)->Video; +$pid=$Video->{'VideoId'}; +goto endtest; + +endtest: + +$json="http://www.starsports.com/divadata/output/VideoData/HLS/json/$pid.json"; +$showc = file_get_contents($json, false, $context); +$m3u8=json_decode($showc)->videosource; +$rhls="http://m.starsports.com/tokens/portal/test/iOSStream.aspx?url=$m3u8"; +$rrhls = file_get_contents($rhls, false, $context); +$m3u8final=json_decode($rrhls)->url; +$filename=json_decode($showc)->SEO; +$m3u8final=str_replace("http","hlsvariant://http",$m3u8final); + + + + + + + +if(isset($argv[3])){ + if(isset($argv[3]) AND ($argv[5]=='d')){ + + + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[4]livestreamer \"$m3u8final\" \"$argv[2]\" -o \"$argv[3]$filename.ts\" &"); + echo "Done.\n"; + } + else{ + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[4]livestreamer \"$m3u8final\" \"$argv[2]\" &"); + echo "Done.\n"; + } + } + else{ + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[2]livestreamer \"$m3u8final\" &"); + } + + +?> diff --git a/starsportslivestreamer.sh b/starsportslivestreamer.sh new file mode 100644 index 0000000..8708698 --- /dev/null +++ b/starsportslivestreamer.sh @@ -0,0 +1,11 @@ +#/bin/bash +echo "paste the link" +read link +folder=$PWD/videos/ +livestreamer="" +php starsportslivestreamer.php "$link" "$livestreamer" +echo "write quality (example write 720p)" +read quality +echo "play or download? (write p or d)" +read choice +php starsportslivestreamer.php "$link" "$quality" "$folder" "$livestreamer" "$choice" diff --git a/test-without-vpn-hotstarlivestreamer.bat b/test-without-vpn-hotstarlivestreamer.bat new file mode 100644 index 0000000..fd62516 --- /dev/null +++ b/test-without-vpn-hotstarlivestreamer.bat @@ -0,0 +1,19 @@ +@ echo off +call set /p link=paste the link: +call set last=%%link:~-1,1%% +call set folder="%~dp0\videos\\" +call set livestreamer="%~dp0\tools\livestreamer\\" +call "%~dp0\tools\php5.4\php.exe" test-without-vpn-hotstarlivestreamer.php "%%link%%" +IF %last% NEQ c GOTO:nocollection +call set /p id=enter the Id of the video (example write 1000021386): +call "%~dp0\tools\php5.4\php.exe" test-without-vpn-hotstarlivestreamer.php "%%link%%" "%%id%%" +call set /p quality=write quality (example write 720p): +call "%~dp0\tools\php5.4\php.exe" test-without-vpn-hotstarlivestreamer.php "%%link%%" "%%id%%" "%%quality%%" "%%folder%%" "%%livestreamer%%" +GOTO end1 +:nocollection +call set /p quality=write quality (example write 720p): +call set /p choice=play or download? (write p or d): +call "%~dp0\tools\php5.4\php.exe" test-without-vpn-hotstarlivestreamer.php "%%link%%" "%%quality%%" "%%folder%%" "%%livestreamer%%" "%%choice%%" +:end1 +pause +:end diff --git a/test-without-vpn-hotstarlivestreamer.php b/test-without-vpn-hotstarlivestreamer.php new file mode 100644 index 0000000..28a3d72 --- /dev/null +++ b/test-without-vpn-hotstarlivestreamer.php @@ -0,0 +1,212 @@ + array('user_agent' => 'custom user agent string', 'X-Forwarded-For'=> '27.123.127.255')); + + $context = stream_context_create($options); + + $showc = file_get_contents($collec, false, $context); + + $resultObj=json_decode($showc)->resultObj; + + $contentInfo=$resultObj->{'contentInfo'}; + + $contentInfo2=($contentInfo[0]); + + $realpidc = $contentInfo2->categoryId; + + $collecs="http://account.hotstar.com/AVS/besc?action=GetArrayContentList&categoryId=$realpidc&channel=PCTV"; + + $showcs = file_get_contents($collecs, false, $context); + + $resultObjs=json_decode($showcs)->resultObj; + + $contentList=$resultObjs->{'contentList'}; + + if(isset($argv[2])){ + + $title="http://account.hotstar.com/AVS/besc?action=GetAggregatedContentDetails&channel=PCTV&contentId=$argv[2]"; + + $show = file_get_contents($title, false, $context); + + $resultObj=json_decode($show)->resultObj; + + $contentInfo=$resultObj->{'contentInfo'}; + + $contentInfo2=($contentInfo[0]); + + $contentTitle = $contentInfo2->contentTitle; $contentTitle=str_replace(" ","-",$contentTitle); + + $episodeTitle = $contentInfo2->episodeTitle; $episodeTitle=str_replace(" ","-",$episodeTitle); + + $episodeNumber= $contentInfo2->episodeNumber; $episodeNumber="episode$episodeNumber"; + + $filename= "'$contentTitle'_'$episodeNumber'_'$episodeTitle'"; + + $filename=iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $filename); + + $filename = preg_replace('/[^A-Za-z0-9_\. -]/', '', $filename); + + $json="http://getcdn.hotstar.com/AVS/besc?action=GetCDN&asJson=Y&channel=TABLET&id=$argv[2]&type=VOD"; + + $test=file_get_contents($json, false, $context); + + $obj=json_decode($test)->resultObj; + + $hls=$obj->{'src'}; + + $testhttps=strpos($hls, 'https'); + + if($testhttps){ + $m3u8p=str_replace("https","hlsvariant://https",$hls); + } + else{ + $m3u8p=str_replace("http","hlsvariant://http",$hls); + } + + $m3u8=str_replace("2000,_STAR.","2000,3000,4500,_STAR.",$m3u8p); + + $badformat = array("4500","3000","2000","1300","800","400","180","106","54","16"); + + $googformat = array("1080p", "900p","720p","404p","360p","234p","","","",""); + + $quality = str_replace($badformat, $googformat, $m3u8); + + $endq= strrpos($quality, ','); $beginq= strpos($quality, ','); $endrq = $endq - $beginq ; + $bitrate= substr($quality, $beginq , $endrq); $bitrate=str_replace(","," ",$bitrate); + + if(isset($argv[3])){ + } + else{ + echo "Available streams: $bitrate\n"; + } + + } + else{ + foreach($contentList as $r){ + echo "Id:".$r->contentId." "."episodeTitle:".$r->episodeTitle." "."contentTitle:".$r->contentTitle."\n"; + } + } + if(isset($argv[3]) AND isset($argv[2])){ + + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[5]livestreamer --http-header \"X-Forwarded-For=27.123.127.255\" \"$m3u8\" \"$argv[3]\" -o \"$argv[4]$filename.ts\" &"); + echo "Done.\n"; + } + else{ + } + +} +else{ + + $folder = ""; + + $ppid= strrpos($argv[1], '/'); + + $id = substr($argv[1], $ppid); + + $pid=str_replace("/","",$id); + $pid = substr($pid, -10); + + $title="http://account.hotstar.com/AVS/besc?action=GetAggregatedContentDetails&channel=PCTV&contentId=$pid"; + + $json="http://getcdn.hotstar.com/AVS/besc?action=GetCDN&asJson=Y&channel=TABLET&id=$pid&type=VOD"; + + $options = array('http' => array('user_agent' => 'custom user agent string', 'X-Forwarded-For'=> '27.123.127.255')); + + $context = stream_context_create($options); + + $show = file_get_contents($title, false, $context); + + $resultObj=json_decode($show)->resultObj; + + $contentInfo=$resultObj->{'contentInfo'}; + + $contentInfo2=($contentInfo[0]); + + $contentTitle = $contentInfo2->contentTitle; $contentTitle=str_replace(" ","-",$contentTitle); + + $episodeTitle = $contentInfo2->episodeTitle; $episodeTitle=str_replace(" ","-",$episodeTitle); + + $episodeNumber= $contentInfo2->episodeNumber; $episodeNumber="episode$episodeNumber"; + + $filename= "'$contentTitle'_'$episodeNumber'_'$episodeTitle'"; + + $filename=iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $filename); + + $filename = preg_replace('/[^A-Za-z0-9_\. -]/', '', $filename); + + $test=file_get_contents($json, false, $context); + + $obj=json_decode($test)->resultObj; + + $hls=$obj->{'src'}; + + $testhttps=strpos($hls, 'https'); + + if($testhttps){ + $m3u8p=str_replace("https","hlsvariant://https",$hls); + + } + else{ + $m3u8p=str_replace("http","hlsvariant://http",$hls); + } + $testhttps2=strpos($m3u8p, 'https'); + if($testhttps2){ + $m3u8=str_replace("2000,_STAR.","2000,3000,4500,_STAR.",$m3u8p); + + } + else{ + $m3u8=str_replace("2000,_STAR.","2000,_STAR.",$m3u8p); + } + + + + + $badformat = array("4500","3000","2000","1300","800","400","180","106","54","16"); + + $googformat = array("1080p", "900p","720p","404p","360p","234p","","","",""); + + $quality = str_replace($badformat, $googformat, $m3u8); + + $endq= strrpos($quality, ','); $beginq= strpos($quality, ','); $endrq = $endq - $beginq ; + $bitrate= substr($quality, $beginq , $endrq); + + $bitrate=str_replace(","," ",$bitrate); + + + if(isset($argv[2])){ + if(isset($argv[2]) AND ($argv[5]=='d')){ + + + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[4]livestreamer --http-header \"X-Forwarded-For=27.123.127.255\" \"$m3u8\" \"$argv[2]\" -o \"$argv[3]$filename.ts\" &"); + echo "Done.\n"; + } + else{ + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[4]livestreamer --http-header \"X-Forwarded-For=27.123.127.255\" \"$m3u8\" \"$argv[2]\" &"); + echo "Done.\n"; + } + } + else{ echo "Available streams: $bitrate\n"; + } + + + +} + +?> diff --git a/voot.php b/voot.php new file mode 100644 index 0000000..b9ed22b --- /dev/null +++ b/voot.php @@ -0,0 +1,59 @@ + array('user_agent' => 'Mozilla/5.0 (X11 Linux i686 rv:42.0) Gecko/20100101 Firefox/42.0 Iceweasel/42.0', 'X-Forwarded-For'=> '27.123.127.255')); + +$url = "http://cdnapi.kaltura.com/api_v3/index.php?service=multirequest&apiVersion=3.1&expiry=86400&clientTag=kwidget%3Av2.41__5147509b&format=1&ignoreNull=1&action=null&1:service=session&1:action=startWidgetSession&1:widgetId=_1982551&2:ks=%7B1%3Aresult%3Aks%7D&2:contextDataParams:referrer=http%3A%2F%2Fplayer.kaltura.com%2FkWidget%2Ftests%2FkWidget.getSources.html%23__1982551%2C" . $entryId[1] . "&2:contextDataParams:objectType=KalturaEntryContextDataParams&2:contextDataParams:flavorTags=all&2:service=baseentry&2:entryId=" . $entryId[1] . "&2:action=getContextData&3:ks=%7B1%3Aresult%3Aks%7D&3:service=baseentry&3:action=get&3:version=-1&3:entryId=" . $entryId[1] . "&kalsig="; + +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Forwarded-For: 27.123.127.255')); +curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux i686; rv:41.0) Gecko/20100101 Firefox/41.0 Iceweasel/41.0"); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +$result1 = curl_exec($ch); +curl_close ($ch); + +preg_match_all('/\{"flavorParamsId":.*?,(.*?),"frameRate.*?"id":"(.*?)".*?\}/', $result1, $all); + +if(!isset($argv[4])){ + + foreach($all[1] as $r){ + + echo "$r\n"; + + } +} +else{ + + preg_match("/\"bitrate\":$argv[4].*?\"id\":\"(.*?)\"/", $result1, $flavorId); + $link = 'http://video.voot.com/enc/fhls/p/1982551/sp/198255100/serveFlavor/entryId/' . $entryId[1] . '/v/2/pv/1/flavorId/' . $flavorId[1] . '/name/a.mp4/index.m3u8'; + echo "$link\n\n"; + + echo "Starting livestreamer...\n\n"; + echo shell_exec("$argv[3]livestreamer \"hls://$link\" best -o \"$argv[2]$name.ts\" &"); + echo "Done.\n"; + +} + +?> diff --git a/vootffmpeg.bat b/vootffmpeg.bat new file mode 100644 index 0000000..a0af606 --- /dev/null +++ b/vootffmpeg.bat @@ -0,0 +1,11 @@ +@ echo off +call set /p link=paste the link: +call set folder="%~dp0\videos\\" +call set ffmpeg="%~dp0\tools\ffmpeg\\" +call "%~dp0\tools\php5.4\php.exe" vootffmpeg.php "%%link%%" "%%folder%%" "%%ffmpeg%%" +call set /p quality=write bitrate: +call "%~dp0\tools\php5.4\php.exe" vootffmpeg.php "%%link%%" "%%folder%%" "%%ffmpeg%%" "%%quality%%" +:end1 +pause +:end + diff --git a/vootffmpeg.php b/vootffmpeg.php new file mode 100644 index 0000000..9b8e387 --- /dev/null +++ b/vootffmpeg.php @@ -0,0 +1,58 @@ + diff --git a/vootffmpeg.sh b/vootffmpeg.sh new file mode 100644 index 0000000..cdc1471 --- /dev/null +++ b/vootffmpeg.sh @@ -0,0 +1,12 @@ +#/bin/bash +echo "paste the link" +read link + +folder=$PWD/videos/ + +ffmpeg="" +php vootffmpeg.php "$link" "$folder" "$ffmpeg" +echo "write bitrate" +read quality + +php vootffmpeg.php "$link" "$folder" "$ffmpeg" "$quality" diff --git a/vootlivestreamer.sh b/vootlivestreamer.sh new file mode 100644 index 0000000..f9331e9 --- /dev/null +++ b/vootlivestreamer.sh @@ -0,0 +1,15 @@ +#/bin/bash +echo "paste the link" +read link + +folder=$PWD/videos/ +livestreamer="" +ffmpeg="" + + +php voot.php "$link" "$folder" "$livestreamer" +echo "write bitrate" +read quality + +php voot.php "$link" "$folder" "$livestreamer" "$quality" +