summaryrefslogtreecommitdiffstats
path: root/youtube.pl
blob: 1291af2549bf99975ca51122d31d5a08bad7441b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl

use LWP::Simple;

if ($#ARGV != 0)
{
   exit;
}

my ($url, $content, $title);
$url = $ARGV[0];

$content = get($url);

if (!defined $content)
{
   exit;
}

if ($content =~ m/<title>(.*?)<\/title>/s)
{
   $title = $1;
   $title =~ s/^\s+//;
   $title =~ s/\s+- YouTube\s+$//;
   print "$title";
}