Skip to content

Instantly share code, notes, and snippets.

@allenday
Created August 2, 2018 14:03
Show Gist options
  • Save allenday/68d4b283ffcc3874121c785f257d26a4 to your computer and use it in GitHub Desktop.
Save allenday/68d4b283ffcc3874121c785f257d26a4 to your computer and use it in GitHub Desktop.
scrape method signatures for ethereum from 4byte.directory
#!/usr/bin/perl
use strict;
use LWP::Simple qw(get);
my $p = 1;
while ( 1 ) {
my $response = get(qq(https://www.4byte.directory/signatures/?page=$p));
while ( $response =~ m#\G.+?<td class="text_signature">(\S+)</td>\s*<td class="bytes_signature"><code>(\w{10})</code></td>#gs ) {
my $txt = $1;
my $sig = $2;
print "$sig\t$txt\n";
}
if ( $response !~ m/aria-label="Next"/s ) {
last;
}
$p++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment