Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as Plain Text by perl5 ( 11 years ago )
#!/usr/bin/env perl
use strict;
use warnings;
use WWW::Mechanize::Firefox;
use Data::Dumper;
use LWP::UserAgent;
use JSON;
use CGI qw/escape/;
use HTML::DOM;
my $mech = WWW::Mechanize::Firefox->new(create => 1, activate => 1);
$mech->get('https://familysearch.org/search/collection/index#count=20&query;=+givenname:Benjamin +surname:Schuvlein +birth_place:Germany +birth_year:1910-1914~ +gender:M +race:White&collection_id=2000219');
my @links = $mech->find_all_links(url_regex => qr/pal:/);
for my $link (@links) {
print Dumper $link->url;
print Dumper $link->text;
}
$mech->autoclose_tab(1);
my $ua = LWP::UserAgent->new;
# my $url;
my $url = 'https://familysearch.org/pal:/MM9.1.1/K3BN-LLJ';
# my $url = $url';
# print "My URL is <$url>\n";
my $request = HTTP::Request->new(GET => $url);
$request->push_header('Content-Type' => 'application/json');
my $response = $ua->request($request);
die "Error ".$response->code if !$response->is_success;
my $dom_tree = new HTML::DOM;
$dom_tree->write($response->content);
$dom_tree->close;
my $str = $dom_tree->getElementsByTagName('table')->[0]->getElementsByTagName("td")->[9]->as_text();
print $str;
Revise this Paste