How to check if stream URL is streaming video - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Tuesday, August 30, 2022

How to check if stream URL is streaming video

I want to know if each url from an m3u file is live streaming video channel or is it dead(No streaming the video).

streamlist.m3u file:

`

#EXTM3U
#EXTINF:-1 tvg-logo="https://ift.tt/mza5eOk" group-title="MOVIES", MOVIES CHANNEL 
https://ift.tt/XxnQ7BZ
#EXTINF:-1 tvg-id="CortTV.mx" tvg-country="MX" tvg-language="Spanish" tvg-logo="https://ift.tt/EIKcu76" group-title="Mexico",CorTV (800p)
https://ift.tt/slzcUO5
#EXTINF:-1 tvg-id="GenesisTV.mx" tvg-country="MX" tvg-language="Spanish" tvg-logo="https://ift.tt/aol3AEG" group-title="Mexico",Genesis TV (720p)
https://ift.tt/cauJGOT
#EXTINF:-1 tvg-id="HipodromodelasAmericas.mx" tvg-country="MX" tvg-language="Spanish" tvg-logo="https://ift.tt/i2B469k" group-title="Mexico",Hipódromo de las Américas (480p)
https://ift.tt/OchbuSz

`

I'm parsing the m3u file to fopen each url but I always get "no stream" .

<CODE>

$lines = file('streamlist.m3u');
$results = preg_grep("/http:/", $lines);
$results = array_values($results);
    for($i=0;$i< count($results);$i++) {        
        if(!$fp = @fopen($results[$i])) {
        echo "no stream</br>";
            } else {
        echo "streaming is active";
        fclose($fp);
    }   
}

</CODE>


source https://stackoverflow.com/questions/73505986/how-to-check-if-stream-url-is-streaming-video

No comments:

Post a Comment