tarkah/lazystream

404 Error

dblanc28 opened this issue · 10 comments

Hello

I just started using lazystream and love it so far. I have expanded to see if i could get the stream to play on a roku stick. I have an IPTV app that I can enter a m3u/m3u8 file or URL and stream to the roku stick. If i enter the m3u8 URL i get from lazystream, like the one below, I get a 404 error. Occasionally while i have been troubleshooting this myself I will get an error saying "med2.med.nhl.com cannot be found"

https://hlslive-akc.med2.med.nhl.com/hdnts=exp=1635396045~acl=/*~id=nhlGatewayId:6352669~data=2026715461~hmac=77173ee0fd8bc6da64afcbff38d741d9bcd50ea12a2e1186802a32f2968790c4/d019783e4a72954f6dbf940a743d624f/va01/nhl/2021/10/26/NHL_GAME_VIDEO_CGYNJD_M2_HOME_20211026_1633540045955/master_wired60.m3u8

If i use the play subcommand, everything works, vlc is launched and im watching the game. but from some reason, attempting to play it somewhere else with the m3u8 URL that is generated, I get an error. Do you guys have any ideas?

Thank you!

You need the DNS overrides to be accessible from the device. If you updated the hosts file on your computer, that doesn't affect the fire stick.

Even if you have a Pihole or something that can be set as a DNS server for your local network via DHCP, those sticks typically have DNS server entries hard coded. Meaning you'd have to setup a firewall to block any external DNS server it's trying to reach, so it'll fall back to your local network DNS.

This program supports casting to Chromecast, that might be an easier solution if you have one / want to pick one up.

Wow you are good. thats exactly what i am doing. I have a pihole doing my networks DNS and it has a couple DNS entries for the lazyman URLs. if i did go the whole firewall route to force it to use my local DNS. would i need any other entries besides the 3 below?

mf.svc.nhl.com 165.22.201.101
mlb-ws-mf.media.mlb.com 165.22.201.101
playback.svcs.mlb.com 165.22.201.101

Nice! Let me know how it goes. I tried it on a fire stick forever ago but never got it working. But it was a super old version.

Yeah that should be it!

Thank you for the quick replies. I do have one more question for you. Not exactly related to a 404 error so if you want me to ask in another thread let me know.

Have you ever been able to play the link in a browser? I have attempted to play the stream in websites like https://www.hlsplayer.net/ and get an error. I was wondering if it was an html problem or maybe a https problem.

I've gotten them to work before, you just have to accept the unsafe SSL cert in browser.

After loading the URL into the player, open developer tools and go to the network tab, you should see the requests it's making. Double click one of them and it should open that request in a new tab / prompt you about it being an unsafe site. Accept and then reload the player and it should work.

There's two different HLS extensions on Firefox. I can't remember which, but one works and one never did.

If you are trying to have the player in the browser a common approach you will see is to hijack the HTTPReqeust the player makes for the key, something along the lines of ..

<script>
(function(open) {
    XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
        var rewrittenUrl = url;
        if (url.indexOf("svcs") != -1) {
            rewrittenUrl = url.replace("https://playback.svcs.mlb.com/", "http://165.22.201.101/");
        }
        open.call(this, method, rewrittenUrl, async, user, pass);
    };
})(XMLHttpRequest.prototype.open);
</script>

Reference: https://cracksmart.com/2019/11/09/illegal-streams-decrypting-m3u8s-and-building-a-better-stream-experience/

Thank you both for your replies. that cracksmart article was educational for me. I put in a few hours yesterday to attempt get a stream working on a webpage but that may not be an option anymore. It looks like Lazyman has decided to call it quits and have turned off there service, so I am not able to use redirect to there server anymore. I guess i will be on the hunt to see if there is anyone with a similar setup to lazyman that i would be able to use.

Thank you again for your help and your quick replies to my comments. Hopefully lazyman will come back one day.

I just released a new version today that plugs into the new host. Try the latest version out, it should work.

oh thats great, thank you, I was able to start trying again but still getting 403 errors. I have added the script @timbenroeck suggested and i think it is working correctly. If i add another elseif statement to replace https://hlslive-akc.med2.med.nhl.com with http://165.22.201.101/ I see that it gets changed when looking at developer tools. Looking at the response it is an access denied reponse and just says i dont have access to the m3u8 on the server:

Access Denied
You don't have permission to access "http://hlslive-akc.med2.med.nhl.com/hdnts=exp=1635741920%7eacl=/*%7eid=nhlGatewayId:6352669%7edata=2026713671%7ehmac=16d412fc07dc6e8aba37e5d9a340b61f3d57411bfc2731d1912519cb1a84e06d/607ba08fc5f332c2add96ff724f883f3/va01/nhl/2021/10/30/NHL_GAME_VIDEO_NJDPIT_M2_VISIT_20211030_1633457574328/3500K/3500_complete-trimmed.m3u8" on this server.

For reference, below is the entirety of my webpage. basically some styling and the video, nothing else. I am going to continue to mess around with it and try to figure it out, but as always if you guys have an suggestions that would be greatly appreciated. Wouldnt surprise me if its something small and i have just been staring at my screen for too long haha.

!DOCTYPE html>



<title>HockeyGame</title>

 <link href="style.css" rel="stylesheet">
  <script src="https://unpkg.com/video.js/dist/video.js"></script>
  <script src="https://unpkg.com/videojs-contrib-hls/dist/videojs-contrib-hls.js"></script>
</head>
<body>
  <video id="my_video_1" class="video-js vjs-fluid vjs-default-skin"controls preload="auto" data-setup='{}'>
    <source  src="https://hlslive-akc.med2.med.nhl.com/hdnts=exp=1635741920~acl=/*~id=nhlGatewayId:6352669~data=2026713671~hmac=16d412fc07dc6e8aba37e5d9a340b61f3d57411bfc2731d1912519cb1a84e06d/607ba08fc5f332c2add96ff724f883f3/va01/nhl/2021/10/30/NHL_GAME_VIDEO_NJDPIT_M2_VISIT_20211030_1633457574328/3500K/3500_complete-trimmed.m3u8">
    <script>
    (function(open) {
      XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
    var rewrittenUrl = url;
    if (url.indexOf("svc") != -1) {
        rewrittenUrl = url.replace("https://mf.svc.nhl.com/", "http://165.22.201.101/");
    } else if (url.indexOf("svcs") != -1) {
        rewrittenUrl = url.replace("https://playback.svcs.mlb.com/", "http://165.22.201.101/");
    } else if (url.indexOf("mlb") != -1) {
        rewrittenUrl = url.replace("https://mlb-ws-mf.media.mlb.com/", "http://165.22.201.101/");
    }
open.call(this, method, rewrittenUrl, async, user, pass);
    };
})(XMLHttpRequest.prototype.open);
  </script>
   </video>
    <h2>Move up!</h2>
</body>
</html>

Hey Guys, got it working sort of the way i wanted but good enough. @tarkah you were right about needing to accept the risk on the certificate and I found a firefox extension that worked for playing these streams. The odd thing to me was that the html i posted in the last comment didnt work but if I just browsed to the stream link, it would play. But trying to embed it in my webpage did not work. im going to try having an option in my webpage to select a feed and just let the video open in another tab.

Your help definitely got me to where i wanted to be. So thank you again, I appreciate all the help.