git-svn-id: svn+ssh://llin.lib/home/dpavlin/private/svn/Z3950-HTML-Scraper@7
ae73d1a6-5fa4-44a9-8f13-
f281fb455051
my $url = 'http://cobiss.izum.si/scripts/cobiss?ukaz=GETID&lani=en';
my $url = 'http://cobiss.izum.si/scripts/cobiss?ukaz=GETID&lani=en';
$mech->follow_link( text_regex => qr/union/ );
$mech->follow_link( text_regex => qr/union/ );
-diag "# switch to advanced form (select)";
+diag "switch to advanced form (select)";
$mech->follow_link( url_regex => qr/mode=3/ );
$mech->follow_link( url_regex => qr/mode=3/ );
-diag "# submit search $query";
+diag "submit search $query";
$mech->submit_form(
fields => {
$mech->submit_form(
fields => {
-diag "# got $hits results, get first one";
+diag "got $hits results, get first one";
$mech->follow_link( url_regex => qr/ukaz=DISP/ );
$mech->follow_link( url_regex => qr/ukaz=DISP/ );
-diag "# in COMARC format";
+diag "in COMARC format";
$mech->follow_link( url_regex => qr/fmt=13/ );
}
$mech->follow_link( url_regex => qr/fmt=13/ );
}
my $nr = $2;
my $id = $3;
my $nr = $2;
my $id = $3;
-diag "# fetch_marc $nr [$id]";
+diag "fetch_marc $nr [$id]";
$comarc =~ s{</?b>}{}gs;
$comarc =~ s{<font[^>]*>}{<s>}gs;
$comarc =~ s{</?b>}{}gs;
$comarc =~ s{<font[^>]*>}{<s>}gs;
my $marc = MARC::Record->new;
foreach my $line ( split(/[\r\n]+/, $comarc) ) {
my $marc = MARC::Record->new;
foreach my $line ( split(/[\r\n]+/, $comarc) ) {
if ( $line !~ s{^(\d\d\d)([01 ])([01 ])}{} ) {
diag "SKIP: $line";
} else {
$line .= "<eol>";
if ( $line !~ s{^(\d\d\d)([01 ])([01 ])}{} ) {
diag "SKIP: $line";
} else {
$line .= "<eol>";
+ our @f = ( $1, $2, $3 );
sub sf { push @f, @_; }
$line =~ s{<s>(\w)<e>([^<]+)\s*}{sf($1, $2)}ges;
sub sf { push @f, @_; }
$line =~ s{<s>(\w)<e>([^<]+)\s*}{sf($1, $2)}ges;
- diag "# f:", join('|', @f), " left: |$line|";
+ diag "f:", join('|', @f), " left: |$line|";
$marc->add_fields( @f );
}
}
$marc->add_fields( @f );
}
}