Spark-NF / hls-downloader

Download HLS streams in NodeJS
Apache License 2.0
73 stars 32 forks source link

How to download HLS directly from a websocket server? #16

Open zydjohnHotmail opened 3 years ago

zydjohnHotmail commented 3 years ago

Hello: I found one of the soccer games web pages, the following useful information:

<script src='https://client.1proxy.xyz/socket.io/socket.io.js'></script>

var socket = io("wss://client.1proxy.xyz");
socket.on("connect", () => {
    socket.emit("d", videoId);
});

var videoId = getParameterByName("id");
var country = getParameterByName("country");
var playerInstance = jwplayer("mediaplayer");

playerInstance.setup({
    "playlist": [{
        "sources": [{
            "default": false,
            "type": "hls",
            "file": "https://m3u8.1proxy.xyz/media/${videoId}/playlist.m3u8",
            "label": "0"
        }]
    }],
    primary: "html5",
    hlshtml: true,
    autostart: true,
    mute: false,
    width: "100%",
    height: "100vh",
    liveTimeout: 10000
});

I can see that the web site is using jwplayer (version 8.20.5) to play live HLS stream, but the stream seems coming from a socket.io server (secure websocket) at: wss://client.1proxy.xyz

One of such HLS m3u8 link is like this: https://m3u8.1proxy.xyz/media/g_12/playlist.m3u8 So, the {videoId} is g_12. I have tried to use Youtube-DL to download some m3u8 link, but failed, try using Edge Addon: Video DownloadHelper, also failed. I want to know if I can try to download HLS directly from the WSS server: wss://client.1proxy.xyz I want to know if I can use this repo to download M3U8 link directly from a websocket server and save in my local disk as an MP4 file?

Thanks, John