Skip to content

Instantly share code, notes, and snippets.

@anekos
Forked from lolicsystem/anktagcloud.pl
Created October 9, 2012 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anekos/3859867 to your computer and use it in GitHub Desktop.
Save anekos/3859867 to your computer and use it in GitHub Desktop.
anktagcloud.pl -- Ank Pixiv Tool で取得した絵のタグから、自分の性癖を知るためのスクリプト
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use feature ":5.10";
my $dbh = DBI->connect("dbi:SQLite:dbname=ankpixiv.sqlite",
undef,
undef,
{
AutoCommit => 0,
RaiseError => 1,
});
my %count;
eval {
my $ary_ref = $dbh->selectall_arrayref("SELECT tags FROM histories where tags like '%R-18%';");
for my $row (@$ary_ref) {
for (split ' ', $row->[0]) {
$count{$_}++;
}
}
};
if ($@) {
$dbh->disconnect;
die "Error: $@";
}
$dbh->disconnect or warn $!;
say "$count{$_}\t$_" for (sort {$count{$b} <=> $count{$a}} keys %count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment