$url=Read-Host "Input TVer URL "
$wc=New-Object System.Net.WebClient
$wc.Encoding=[System.Text.Encoding]::UTF8
$wc.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko")
$source=$wc.DownloadString($url)
$source -match("addPlayer\(([\s\S]*?)\)") | Out-Null
$temp=$matches[1]
$info=[RegEx]::Matches($temp, "\s*'([\s\S]*?)',") | ForEach{[string]$_.groups[1]}
$account_id, $player_id, $dummy1, $dummy2,
$video_id, $title, $subtitle, $channel_id, $dummy3 = $info
if ($channel_id -eq "cx") {
$video_id = $info[3]
$m3u8 = "https://i.fod.fujitv.co.jp/abr/pc_html5/${video_id}.m3u8"
} else {
If (!($video_id -match("^\d+$"))) {
$video_id = "ref:$video_id"
}
$m3u8 = "https://players.brightcove.net/${account_id}/${player_id}_default/index.html?videoId=${video_id}"
}
./youtube-dl "${m3u8}" -o "${title}${subtitle}.mp4"