m3u8-grabber
v1.0.7
Published
A simple m3u8 archiver that downloads everything 'as-is' to GCP storage
Downloads
14
Maintainers
Readme
HELP ME!
- If this was helpful to you, please buy me a beer on PayPal: Click Here to Buy Me a Beer
m3u8 Grabber
This will take a m3u8 URL and recursively download the file itself, .ts
video files, and any .key
encryption key files.
It will try to preserve the structure of everything "as-is" without distrurbing
how the files are. It will then upload everything to Google Cloud Storage.
Usage
Typescript example
import path from 'path';
import { Storage } from '@google-cloud/storage';
import {
downloadM3u8,
} from 'm3u8-grabber';
const jsonFilePath = path.resolve(__dirname, 'google-credentials.json');
const jsonData = fs.readFileSync(jsonFilePath, 'utf-8');
const keyFile = JSON.parse(jsonData) as never;
const storage = new Storage({
credentials: keyFile,
});
await downloadM3u8(
storage, // <-- Google Cloud Storage JS/TS client.
'https://my-url.com/hls/index.m3u8', // <-- The m3u8 URL
'my-gcs-bucket', // <-- Google Cloud Storage Bucket
'output', // <--- The local output folder name on disk for m3u8 files.
'my-user-1234', // <-- The remote Google Cloud Storage "folder" output.
);
HELP ME!
- If this was helpful to you, please buy me a beer on PayPal: Click Here to Buy Me a Beer