Fix the aupay links #5

- This is a stop gap to make it reasonable until
  I swap out Text::Template for Text::Xslate.
This commit is contained in:
gg 2023-09-03 00:17:01 -07:00
parent dcdfdd4389
commit 0dd78fbc4d
2 changed files with 26 additions and 6 deletions

View File

@ -37,6 +37,19 @@ sub thumb {
"https://site.weathernews.jp/app/wnlive/thumb/$x/$id.jpg"
}
# m3u8 link for aupay video_id
sub aupay_m3u8 {
my $id = shift;
my $quality = shift || '1080p';
"https://vod.check.tv/lives/$id/$quality/index.m3u8";
}
# thumbnail for aupay video_id
sub aupay_th {
my $id = shift;
"https://image.check.tv/lives/$id/vertical.jpg";
}
sub tlink {
my $title = shift;
my $escaped = $title; $escaped =~ s/ /+/;

View File

@ -11,17 +11,24 @@
<tbody>
{ $indent = ""; foreach (@r) {
if ($_->{video_id}) {
$yt = sprintf('<a href="%s">yt</a> | <a href="%s">th</a>',
yt($_->{video_id}),
thumb($_->{video_id})
);
if ($_->{title} eq 'au PAY') {
$links = sprintf('<a href="%s">m3u8</a> | <a href="%s">th</a>',
aupay_m3u8($_->{video_id}),
aupay_th($_->{video_id})
);
} else {
$links = sprintf('<a href="%s">yt</a> | <a href="%s">th</a>',
yt($_->{video_id}),
thumb($_->{video_id})
);
}
} else {
$yt = "";
$links = "";
}
$t = tlink($_->{title});
$c = clink($_->{caster});
$mscale = $_->{mscale} ? "m$_->{mscale}" : "m";
$OUT .= "$indent<tr class=\"$mscale\"><td>$t</td><td>$c</td><td>$yt</td><td>$_->{jst}</td></tr>\n";
$OUT .= "$indent<tr class=\"$mscale\"><td>$t</td><td>$c</td><td>$links</td><td>$_->{jst}</td></tr>\n";
$indent = " ";
} }
</tbody>