commit 48c1da5086f9f301aad4bd750b0d6e2eae51bd14
parent b017d04575d36612f1d04d5de25c54f3cd90e26d
Author: boredpasta <boredpasta@tutanota.com>
Date: Sun, 16 Mar 2025 23:33:31 +0200
kill bad characters [\000\r\n] and trim title for yt title command
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/mata_bot.pl b/mata_bot.pl
@@ -79,6 +79,9 @@ sub respond {
}
my $content = $response->{content};
if ($content =~ m,<span class="title"><a href="https://www\.youtube\.com/watch\?v=$video_id" accesskey="0">([^<]+)</a>,) {
+ my $title = $1;
+ $title =~ tr/[\000\r\n]//d;
+ $title = trim($title);
msg($sock, "YouTube: $title");
} else {
msg($sock, "failed to get title of video $video_id <[x~x]> (no videos matching ID $video_id!)");