Skip to content

Commit

Permalink
better entity extraction script
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 26, 2012
1 parent 5e006e1 commit 5649450
Show file tree
Hide file tree
Showing 2 changed files with 2,236 additions and 2,234 deletions.
8 changes: 5 additions & 3 deletions examples/entities.pl
Expand Up @@ -3,11 +3,13 @@
use Mojo::Base -strict;

# "She's built like a steakhouse, but she handles like a bistro!"
use Mojo::ByteStream 'b';
use Mojo::UserAgent;

# Extract named character references from HTML5 spec
Mojo::UserAgent->new->get('http://dev.w3.org/html5/spec/single-page.html')
->res->dom("#named-character-references-table tbody > tr")
->each(sub { say $_->at("td > code")->text, $_->children("td")->[1]->text });
my $tx
= Mojo::UserAgent->new->get('http://dev.w3.org/html5/spec/single-page.html');
b($_->at('td > code')->text . $_->children('td')->[1]->text)->trim->say
for $tx->res->dom('#named-character-references-table tbody > tr')->each;

1;

0 comments on commit 5649450

Please sign in to comment.