Skip to content

Instantly share code, notes, and snippets.

@kyleskrinak
Created February 15, 2014 16:35
Show Gist options
  • Save kyleskrinak/9021709 to your computer and use it in GitHub Desktop.
Save kyleskrinak/9021709 to your computer and use it in GitHub Desktop.
Perl script to check a dynamically-generated web site
#!/usr/bin/perl -w
use constant SITEMAP => "http://v.box:10144/sitemap.xml";
use constant MAX_PAGES => 10;
$npages = 0;
for (qx{curl --silent @{[SITEMAP]}}) {
m{<loc>(.*?)</loc>} or next;
$page = $1;
++$npages > MAX_PAGES and last;
print "$page\t"; # here so if aspell crashes, we know which page
$typos = qx{curl --silent $page | aspell --mode=html --home-dir=. --personal=dict.txt list};
$typos =~ tr{\n}{ };
print "$typos\n"
}
@kyleskrinak
Copy link
Author

Taken from drupal.stackexchange I made some mac-specific updates. Of course, you'll need aspell, curl and xmlsitemap to automatically generate the pages you wish to check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment