v16 Play M3u8 with AuthSign parameter
#1
Hi,
I have an URL which is
Code:
http://live1.karwan.tv/karwan.tv/net-tv/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9MS8xNi8yMDE3IDI6Mzk6MDggUE0maGFzaF92YWx1ZT1pdVlZYW9PVHZhVGYvdUhUSGtzajVBPT0mdmFsaWRtaW51dGVzPTIw
As you see the code includes some wmsAuthSign that is jQuery string parameter. This changes every 20th minutes and I can not play it after a while. How do I work around this? is there any php or programming thing that I can use on any free servers that can get the video and remove the parameter[/code]? or am I just dreaming?

Is there any solution to this?
Reply
#2
You have to do it in PHP and use CURL function (Web Scraping).
Next -> Create php file with appropriate headers
Is also useful: .htaccess

Example:

http://example.com/stream.m3u
Quote:<?php

$stream_url = "Huh"; // scraping with web page use curl in php

header('Content-Type: application/octet-stream');
echo "#EXTM3U\n";
echo "#EXTINF:-1," . $stream_name . "\n";
echo $stream_url;
Reply
#3
(2017-02-20, 03:31)tinware Wrote: You have to do it in PHP and use CURL function (Web Scraping).
Next -> Create php file with appropriate headers
Is also useful: .htaccess

Example:

http://example.com/stream.m3u
Quote:<?php

$stream_url = "Huh"; // scraping with web page use curl in php

header('Content-Type: application/octet-stream');
echo "#EXTM3U\n";
echo "#EXTINF:-1," . $stream_name . "\n";
echo $stream_url;
Hi,Thanks for your respose. Could you please explain it to me. can you make an example with the link I provided? do O make such file for each channel?
Reply
#4
(2018-05-18, 03:19)Payam30 Wrote: Hi,Thanks for your respose. Could you please explain it to me. can you make an example with the link I provided? do O make such file for each channel? 

I know it's an old post, but I came across it trying to solve a similar issue myself, trying to get a stream from a webcam with a changing token. I've probably taken way too many detours, but here's how I solved it:

1. On my PHP server, I created a .php file to get the current working URL for the stream. In my case, the video url is always https://url_of_the_videostream?token= followed by a long token string. This script (with a big thank you to http://scraping.pro/scraping-in-php-with-curl/) gets the webpage which has the embedded webcam url with current token string, uses a bit of regex to find that token, and puts it together with the fixed part of the url to make the currently working url:
php:
<?php

$curl = curl_init('https://www.url with the embedded code for the webcam/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);

$page = curl_exec($curl);
$stream_name = "Webcam";

if(curl_errno($curl)) // check for execution errors
{
    echo 'Scraper error: ' . curl_error($curl);
    exit;
}

curl_close($curl);

$regex = '/token=(.*?)"/';
if ( preg_match($regex, $page, $match) )
    $stream_url =  "https://url_of_the_videostream?token=".$match[1];
else ($stream_url =  "error");

header('Content-Type: application/octet-stream');
echo "#EXTM3U\n";
echo "#EXTINF:-1," . $stream_name . "\n";
echo $stream_url;

?>

2. Because Kodi won't play a .php file, I added this line to my .htaccess, so this .php file that already has the content of a .m3u, now also has the right filename:
html:
RewriteRule webcam\.m3u /webcam.php

3. So far, that's all on my PHP server. On the storage attached to my Kodi, I created a webcam.strm file with just the URL of the (non existant) .m3u:
html:
http://root_of_my_web_server/webcam.m3u

And then when you play that .strm file, it calls on the .m3u which is really a .php!

Hope that helps someone!
Reply
#5
Hello, i have been trying to do the same with a m3u8 link which uses nimblesessionid. I can't figure out a possible way
Reply
#6
Example of the link with nimblesessionid is http://51.15.8.16:8081/lpcind1/starsport...bnV0ZXM9Mg==
Reply
#7
Somehow that doesn't look the most legal and legitimate of urls, in respect to our piracy policy (wiki)...
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply

Logout Mark Read Team Forum Stats Members Help
Play M3u8 with AuthSign parameter0