VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. Member
    Join Date
    Dec 2018
    Location
    Germany
    Search PM
    Hello everybody,



    This is my php script for Karwan Tv

    Code:
    <?PHP
    header("Content-Type: audio/mpegurl");
    header("Content-Disposition: attachment; filename=knn-tv.m3u");
    echo "#EXTINF:0,KNN\n"; 
    $kaynak = file_get_contents("http://live1.karwan.tv/karwan.tv/knn-tv/playlist.m3u8"); 
    preg_match('@file: "(.*?)"@s',$kaynak,$m3u); 
    echo ($m3u[1]); echo "\n";
    ?>
    I get the link with this script and write it in a m3u file, to play with Live TV in VLC or othe IPTV apps.

    But my link doesnt work,so I need your help.

    Can everybody tell me how it is work?
    Quote Quote  
  2. Tubedigger (free trial will download 4MB of live stream) downloads the live stream from that website. Maybe somebody else can answer your php question.
    Quote Quote  
  3. Member
    Join Date
    Dec 2018
    Location
    Germany
    Search PM
    no one knows this from here

    plz help
    Quote Quote  
  4. Member
    Join Date
    Dec 2018
    Location
    Germany
    Search PM
    ok, so I find this php code of the site.

    Code:
    <script type="text/javascript" src="http://karwan.tv//player-file/jwplayer.js"></script>
    <script>jwplayer.key="QybHxeEatECB7VWGt/y7fw69lOha2N4x3Es4kNK1RhDAmYzB"</script>
    <div id="myElement"></div>
    <script>
    jwplayer("myElement").setup({
    autostart:'true',
    androidhls:'true',
    skin: 'bekle',
    repeat: 'true' ,
    preload: "metadata",
    stretching:'exactfit',
    width: "100%",
    height: "100%",
    skin: 'bekle',
        "skin": {
        "name": "bekle",
        "active": "#FFFF00",
        "background": "#008000",
        "inactive": "#FFFFFF",
     },
      "sharing": {
        "heading": "www.karwan.tv",
        "link": "http://karwan.tv/",
        "sites": [
          "facebook",
          "twitter",
          "googleplus",
        ]
    },
    
    "logo": {
        "file": "http://karwan.tv//logo/karwan-tv/karwan-tv-2.png",
        "hide": true,
        "link": "http://karwan.tv/",
        "margin": "5",
        "position": "top-left"
      },
    image: "http://karwan.tv//logo/karwan-tv/karwan-tv-1.png",
    file: "h**p://live1.karwan.tv/karwan.tv/arti-tv/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9MS8xLzIwMTkgMTE6MDQ6MTMgUE0maGFzaF92YWx1ZT0zd2NyL2xQV0VQU2NQZjhjTzh0NDVBPT0mdmFsaWRtaW51dGVzPTIw",
    'abouttext':'www.karwan.tv',
    'aboutlink':'http://www.karwan.tv/',
      "cast": {
        "appid": "D4D33816"
      },
     advertising: {
    client: 'googima',
                        schedule: {
                            preadbreak: {
                                offset: "pre",
                                tag: 'https://googleads.g.doubleclick.net/pagead/ads?ad_type=video_text_image&client=ca-video-pub-7224811128914379&description_url=http%3A%2F%2Fkarwan.tv&channel=8518832448&hl=en'
                            },
                            adbreak1: {
                                offset: "1800",
                                tag: 'https://googleads.g.doubleclick.net/pagead/ads?ad_type=video_text_image&client=ca-video-pub-7224811128914379&description_url=http%3A%2F%2Fkarwan.tv&channel=8518832448&hl=en'
                            },
                            adbreak2: {
                                offset: "3600",
                               tag: 'https://googleads.g.doubleclick.net/pagead/ads?ad_type=video_text_image&client=ca-video-pub-7224811128914379&description_url=http%3A%2F%2Fkarwan.tv&channel=8518832448&hl=en'
                                 },
                            adbreak3: {
                                offset: "5400",
                               tag: 'https://googleads.g.doubleclick.net/pagead/ads?ad_type=video_text_image&client=ca-video-pub-7224811128914379&description_url=http%3A%2F%2Fkarwan.tv&channel=8518832448&hl=en'
    
                                 },
                            adbreak4: {
                                offset: "7200",
                               tag: 'https://googleads.g.doubleclick.net/pagead/ads?ad_type=video_text_image&client=ca-video-pub-7224811128914379&description_url=http%3A%2F%2Fkarwan.tv&channel=8518832448&hl=en'
    
                                },
                            adbreak5: {
                                offset: "9000",
                               tag: 'https://googleads.g.doubleclick.net/pagead/ads?ad_type=video_text_image&client=ca-video-pub-7224811128914379&description_url=http%3A%2F%2Fkarwan.tv&channel=8518832448&hl=en'
        }
       }
      }
    });
    </script>

    If I give this file: " in my php script, it doesn't work on VLC or IPTV pro apk.

    Can someone help me now?
    Quote Quote  
  5. Hi,
    if you use directly link and tested it with vlc it will not works, because they are not allowed it to work with vlc user agent and other players also.


    this script made for you

    Code:
    <?php
    $opts1 = array(
      'http'=>array(
        'method'=>"GET",
        'header'=>"Referer: http://karwan.tv/knn-tv.html" .
    		"User-Agent: Mozilla/5.0 (X11; Linux i686; rv:41.0) Gecko/20100101 Firefox/41.0"
      )
    );
    $return=file_get_contents("http://karwan.tv/live/knn-tv.php", false, stream_context_create($opts1));
    preg_match('/file: "(.*?)"/', $return, $m3u8);
    echo "$m3u8[1]\n\n";
    echo "Starting vlc...\n\n";
    
    		echo shell_exec(" livestreamer --http-header \"User-Agent=Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36\" hlsvariant://$m3u8[1] best -o- |\"C:\\Program Files (x86)\\VideoLAN\VLC\\vlc.exe\" - --file-caching 1000 --network-caching 1000 &");
    		echo "Done.\n";
    
    ?>


    do not forget you must use livestreamer plugin in the same folder

    Enjoy.
    Quote Quote  
  6. ю ю
    Last edited by sysanin; 10th Jan 2019 at 03:02.
    Quote Quote  
  7. Member Emeritus
    Join Date
    May 2014
    Search PM
    wmsAuthSign duration is set for 20 minutes. So, any viewing method must renew wmsAuthSign token at least that often.

    server_time=1/1/2019 11:04:13 PM&hash_value=3wcr/lPWEPScPf8cO8t45A==&validminutes=20
    Quote Quote  
  8. He wants to get an "eternal" link.
    Quote Quote  
  9. ю ю
    Last edited by sysanin; 10th Jan 2019 at 03:03.
    Quote Quote  
  10. Речь идёт о времени жизни ссылки как таковой. Через определённое время player её уже не воспроизводит.
    Quote Quote  
  11. Member
    Join Date
    Dec 2018
    Location
    Germany
    Search PM
    thank you very much my friend, so I tested now
    Quote Quote  
  12. Member
    Join Date
    Dec 2018
    Location
    Germany
    Search PM
    can I do that with mx player? and how should I do that in the same folder? php file and the mxplayer.apk together in 1 folder?
    Quote Quote  
  13. Hi all ,

    Thanks to midi23 !!!

    Mine improvments , for running under Win XP .

    Code:
    <?php
    
    strncasecmp(php_uname('s'), "Win", 3) == 0 ? $windows = true : $windows = false;
    
    //**** !!! please modify your livestreamer path here !!! ****
    if ($windows)
    {
    	//path on Windows platforms
    	$livestreamer = "d:\\livestreamer\\livestreamer.exe";
    	if (file_exists("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe")) {
    		$vlc = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";
    	} else if (file_exists("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe")) {
    		$vlc = "C:\\Program Files\\VideoLAN\\VLC\\vlc.exe";
    	} else {
    		$vlc = "C:\\Programmi\\VideoLAN\\VLC\\vlc.exe";
    	}
    }
    else
    {
    	//path on Linux or other platforms
    	$livestreamer  = "d:\\livestreamer\\livestreamer.exe";
    	$vlc = "vlc";
    }
    
    $opts1 = array(
      'http'=>array(
        'method'=>"GET",
        'header'=>"Referer: http://karwan.tv/knn-tv.html" .
    		"User-Agent: Mozilla/5.0 (X11; Linux i686; rv:52.9) Gecko/20100101 Firefox/52.9.0"
      )
    );
    $return=file_get_contents("http://karwan.tv/live/knn-tv.php", false, stream_context_create($opts1));
    preg_match('/file: "(.*?)"/', $return, $m3u8);
    echo "$m3u8[1]\n\n";
    echo "Starting vlc...\n\n";
    
    echo shell_exec("$livestreamer --http-header \"User-Agent=Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36\" hlsvariant://$m3u8[1] best");
    echo "Done.\n";
    
    ?>
    Note :
    _ added lines before $opts1 = array(
    _ modified line echo shell_exec(...
    _ as i am not a programer , verify (???) //path on Linux or other platforms

    Cheers .
    JE SUIS CHARLIE !!!
    Quote Quote  
  14. Member
    Join Date
    Dec 2018
    Location
    Germany
    Search PM
    very good, but how it funtion with android? Do you have another idea?
    Quote Quote  
  15. Member
    Join Date
    Jan 2020
    Location
    Admin Knows
    Search Comp PM
    Hello

    Happy new year to all

    i m learning and learning
    want to knwo where to put the files scripte php files and how to run it

    thnaks a lot

    Cheers
    Quote Quote  
  16. Hello, I made these two scripts. The scripts must be placed in a folder named "karwan-tv".

    name: karwan-tv-list.php (generates the channel list)

    Code:
    <?php
    header("Content-type: text/plain; charset=UTF-8");
    
    $web = file_get_contents('https://karwan.tv/');
    $part = GetBetween($web,'<h2 class="widget-title">', 'vb-column-main"></div></div></div></div><center>');
    preg_match_all('/vb-itemthumb"><a href="https:\/\/karwan.tv\/(.*?).html/', $web, $channels);
    preg_match_all('/,h_80\/(.*?)" class=/', $web, $logos);
    
    
    echo ("#EXTM3U"."\n");
    
    
    $number_channels = count($channels[1]);
    
    for ($i = 0; $i < $number_channels; $i++) {
    	
    echo ('#EXTINF:-1 tvg-logo="'.$logos[1][$i].'", '.$channels[1][$i]."\n");
    
    if ($channels[1][$i] == 'kurdmax-show-tv'){
    	$channels[1][$i] = 'kurdmax-show-tv-so';
    }
    if ($channels[1][$i] == 'kurdmax-sorani'){
    	$channels[1][$i] = 'kurdmax-tv-so';
    }
    if ($channels[1][$i] == 'kurdmax-kurmanci'){
    	$channels[1][$i] = 'kurdmax-tv-ku';
    }
    if ($channels[1][$i] == 'kurdmax-show-kurmanci'){
    	$channels[1][$i] = 'kurdmax-show-tv-ku';
    }
    if ($channels[1][$i] == 'zarok-tv-kurmanci'){
    	$channels[1][$i] = 'zarok-tv-ku';
    }
    if ($channels[1][$i] == 'assyria-sat'){
    	$channels[1][$i] = 'assyriasat';
    }
    if ($channels[1][$i] == 'zarok-tv-zazaki'){
    	$channels[1][$i] = 'zarok-tv-za';
    }
    
    
    
    echo ('http://localhost/karwan-tv/karwan-tv.php?ch='.$channels[1][$i]."\n");
    }
    
    		
    		
    		
    function GetBetween($content,$start,$end){ 
    $r = explode($start, $content);
    if (isset($r[1])){
    $r = explode($end, $r[1]);
    return $r[0];
    }
    return '';
    }

    name: karwan-tv.php (get m3u8)


    Code:
    <?php
    
    $channel=$_GET['ch'];
    header("Content-type: text/plain; charset=UTF-8");
    $web = file_get_contents('https://karwan.tv/live/'.$channel.'.php');
    
    $web2 = preg_replace('/^[\t ]+|[\t ]+$/m', '', $web);
    
    //echo $web2;
    
    $stream = GetBetween($web2,"var src = {".chr(13).chr(10)."hls: '", "'".chr(13).chr(10)."};");
    
    $down1 = file_get_contents($stream);
    
    
    $stream2 = GetBetween($web2,"}, {".chr(13).chr(10)."hls: '", "'");
    
     if (strpos($down1,'m3u8')== !false) { 
    header("Location: ".$stream);
    }else { 
    header("Location: ".$stream2);
    }
    
    
    
    function GetBetween($content,$start,$end){ 
    $r = explode($start, $content);
    if (isset($r[1])){
    $r = explode($end, $r[1]);
    return $r[0];
    }
    return '';
    }
    Quote Quote  



Similar Threads