/[Z3950-HTML-Scraper]/Aleph.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Aleph.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 11 by dpavlin, Fri Oct 22 20:25:51 2010 UTC revision 12 by dpavlin, Fri Oct 22 20:49:16 2010 UTC
# Line 125  print $mech->content; Line 125  print $mech->content;
125    
126  diag "parse $nr";  diag "parse $nr";
127    
128                    my $marc = MARC::Record->new;
129    
130                  my $html = $mech->content;                  my $html = $mech->content;
131                  my $hash;                  my $hash;
132                  $html =~ s|<tr>\s*<td class=td1 id=bold[^>]*>(.+?)</td>\s*<td class=td1>(.+?)</td>|$hash->{$1} = "$2";|ges;  
133                    sub field {
134                            my ( $f, $v ) = @_;
135                            $v =~ s/\Q&nbsp;\E/ /gs;
136    warn "# $f\t$v\n";
137                            $hash->{$f} = $v;
138                            my ($i1,$i2) = (' ',' ');
139                            ($i1,$i2) = ($2,$3) if $f =~ s/^(...)(.)?(.)?/$1/;
140                            my @sf = split(/\|/, $v);
141                            shift @sf;
142                            @sf = map { s/^(\w)\s+//; { $1 => $_ } } @sf;
143    diag "sf = ", dump(@sf);
144                            $marc->add_fields( $f, $i1, $i2, @sf ) if $f =~ m/^\d+$/;
145                    }
146    
147                    $html =~ s|<tr>\s*<td class=td1 id=bold[^>]*>(.+?)</td>\s*<td class=td1>(.+?)</td>|field($1,$2)|ges;
148                  diag dump($hash);                  diag dump($hash);
149    
150                  my $id = $hash->{SYS} || die "no SYS";                  my $id = $hash->{SYS} || die "no SYS";
151    
 die;  
   
                 my $marc = MARC::Record->new;  
152    
 #               $marc->add_fields( $f, $i1, $i2, @{ $out->{$f} } );  
153    
154                  my $path = "marc/$id.$format";                  my $path = "marc/$id.$format";
155    

Legend:
Removed from v.11  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.26