Skip to content

Instantly share code, notes, and snippets.

@book000
Created January 1, 2022 11:17
Show Gist options
  • Save book000/55537bac2ee00af400f6a237c2bd8979 to your computer and use it in GitHub Desktop.
Save book000/55537bac2ee00af400f6a237c2bd8979 to your computer and use it in GitHub Desktop.
Mirakurunを使いVLCでテレビを見れるようにプレイリストを作成するPHPスクリプト
<?php
$json = json_decode(file_get_contents("http://192.168.0.201:40772/api/channels?type=GR"), true);
print_r($json);
$list = [
"#EXTM3U",
"#EXTVLCOPT:network-caching=1000",
""
];
foreach ($json as $object) {
$type = $object['type'];
$channel = $object['channel'];
$name = $object['name'];
if (!isset($object['services'][0])) {
continue;
}
$service = $object['services'][0];
$service_id = $service['id'];
$service_name = $service['name'];
$list[] = "#EXTINF:-1," . $type . " - " . $name . " (" . $service_name . ")";
$list[] = "http://192.168.0.201:40772/api/channels/GR/${channel}/services/${service_id}/stream/";
}
file_put_contents(__DIR__ . "/tv_GR.m3u8", implode("\n", $list));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment