From 5a05f1110317798ccb1dd8ec520e2dae53d0cf6c Mon Sep 17 00:00:00 2001 From: Alexandre Morignot <nightiies@perso.iiens.net> Date: Fri, 14 Jul 2023 15:02:34 +0200 Subject: [PATCH] feat(soundcloud): Use external executable --- PlayBot/sites/soundcloud.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/PlayBot/sites/soundcloud.pm b/PlayBot/sites/soundcloud.pm index 2e15419..e6c2126 100644 --- a/PlayBot/sites/soundcloud.pm +++ b/PlayBot/sites/soundcloud.pm @@ -102,14 +102,18 @@ sub get { shift; my $id = shift; + my $response; + $log->info("the id is ".$id); + + my $content = `./soundcloud $id`; + my ($external_id, $url, $title, $author, $duration) = split(/\n/, $content); + +=cut my $ua = LWP::UserAgent->new( timeout => 30, env_proxy => 1, ); - my $response; - $log->info("the id is ".$id); - if (looks_like_number($id)) { $response = $ua->get( @@ -141,6 +145,16 @@ sub get { if ($content->{'downloadable'}) { $infos->{'ddl'} = $content->{'download_url'}; } +=cut + + my $infos = { + author => $author, + external_id => $external_id, + duration => $duration, + site => 'soundcloud', + title => $title, + url => $url, + }; return %$infos; } -- GitLab