Here, I'm going to discuss all the steps to do a web crawling using any language or technology. Crawler/Scrapper/Spider/Bot/ multiple synonyms for same stuff which is basically meant to copy content from any site. Based on website crawlers need to be configured. Please share your feedback, if it's good then I can post it on a larger platform as well where I'm planning to discuss crawling in java etc as well:

1. Static Content Crawling: Static content are those which are generated once and doesn’t keeps on changing on their own, they need manual intervention and update to push any changes in content. So, such pages are easy to create but such pages are highly prone to security and their content can be crawled easily. So, in this case your crawler would be very efficient and providing accurate result as they simply have to access a page and get details.

2. Dynamic Content Crawling: Dynamic content are those which keeps changing dynamically, in this case page contains server-side code which allows the server to generate a unique content whenever the page is loaded. Since, these contents are dynamically generated using different technology hence they are very secure as well as very difficult to crawl. So, in this case the crawler creation would be very difficult and getting accurate data is also not possible as class names etc are generated on load and there is no html code available on page to get that. Hence, you may have to use different functionalities here such as using proxy or creating robot.txt.

Static Content Crawling
my $mech = WWW::Mechanize->new(); my $response = $mech->get(URL); if ($response->is_success) { print $mech->content; } else { die $response->status_line; }
Dynamic Content Crawling
use WWW::mechanize::Firefox; use Data::Dumper; $mech= WWW::Mechanize::Firefox->new(); $mech->get(URL); %arr_ref = (AL => [1795, 1276, 795, 1719, 1363, 1145, 961, 17, 18, 199 +5, 977, 1910, 1691, 21, 1660, 1768], AK => [1145, 961, 1995, 977, 1781, 1704], AZ => [1873, 872, 1145, 690, 1162, 961, 918, 528, 811, 704, 529, 1983, + 931, 40, 1995, 977, 597, 1157, 530, 598, 886, 782, 42, 691, 1945]); foreach my $key (sort keys %arr_ref) { print "$key :: @{$arr_ref{$key}} \n"; $mech->field( stateUSAId => $key ); foreach (@{$arr_ref{$key}}) { $mech->field(institutionUSAId=>$_); print $mech->content; } }

In reply to Web Crawling using Perl by ckj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.