summaryrefslogtreecommitdiffstats
path: root/parse-fileext.pl
blob: cde0758ff29a2d4a0be6818b448a90cd7d959c1c (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
27
28
29
30
#!/usr/bin/perl

#use strict;
#use warnings;
use Web::Scraper;
use URI;
use HTML::Entities;
use Encode;
use URI::Escape;
use LWP::UserAgent;

my $scrap;

my $wikiurl = "http://filext.com/file-extension/$ARGV[0]";

my $scrapp = scraper {
   process '//table/tr/td', 'chars[]' => 'TEXT';
};
my $url = URI->new($wikiurl);
my $blubb = $scrapp->scrape($url);
my $list = $blubb->{'chars'};

binmode(STDOUT, ":utf8");

for($i = 0; $i <= $#$list;$i++) {
   if ($$list[$i] =~ /^Extension: $ARGV[0]$/i)
   {
      print "$$list[$i+4]\n";
   }
}