Note that there are some explanatory texts on larger screens.

plurals
  1. POScraping multiple items off of a Page into a Neat Row
    primarykey
    data
    text
    <p>As an example:</p> <p>I load in the input from a .txt:</p> <p>Benjamin,Schuvlein,Germany,1912,M,White</p> <p>I do some code that I will not post here for brevity and get to the link:</p> <p><a href="https://familysearch.org/pal:/MM9.1.1/K3BN-LLJ" rel="nofollow">https://familysearch.org/pal:/MM9.1.1/K3BN-LLJ</a></p> <ol> <li>I want to scrape multiple things from that page. In the code below, I only do 1. </li> <li>I'd also like to make each item be separated by a , in the output .txt.</li> <li>And, I'd like the output to be preceded by the input.</li> </ol> <p>I'm using the following packages in the code:</p> <pre><code>use strict; use warnings; use WWW::Mechanize::Firefox; use Data::Dumper; use LWP::UserAgent; use JSON; use CGI qw/escape/; use HTML::DOM; </code></pre> <p>Here's the relevant code:</p> <pre><code>my $ua = LWP::UserAgent-&gt;new; open(my $o, '&gt;', 'out2.txt') or die "Can't open output file: $!"; # Here is the url, although in practice, it is scraped itself using different code my $url = 'https://familysearch.org/pal:/MM9.1.1/K3BN-LLJ'; print "My URL is &lt;$url&gt;\n"; my $request = HTTP::Request-&gt;new(GET =&gt; $url); $request-&gt;push_header('Content-Type' =&gt; 'application/json'); my $response = $ua-&gt;request($request); die "Error ".$response-&gt;code if !$response-&gt;is_success; my $dom_tree = new HTML::DOM; $dom_tree-&gt;write($response-&gt;content); $dom_tree-&gt;close; my $str = $dom_tree-&gt;getElementsByTagName('table')-&gt;[0]-&gt;getElementsByTagName("td")-&gt;[10]-&gt;as_text(); print $str; print $o $str; </code></pre> <p>Desired Output (from that link) is something like:</p> <p>Benjamin,Schuvlein,Germany,1912,M,White,Queens,New York,Married,Same Place,Head, etc ....</p> <p>(How much of that output section is scrapable?)</p> <p>Any help on how to get the link within the link would be much appreciated! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload