Created
November 26, 2012 00:49
-
-
Save pjf/4146046 to your computer and use it in GitHub Desktop.
Turns event invite information into graphviz files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use 5.010; | |
use strict; | |
use warnings; | |
use autodie; | |
local $/ = q{<li class="fbProfileBrowserListItem uiListItem">}; | |
<>; # Discard leader | |
say "digraph invites {"; | |
while (<>) { | |
my ($name) = /data-hovercard=[^>]+>([^<]+)/; | |
my ($invite) = /aria-label="([^"]+)/; | |
if ($invite) { | |
$invite =~ s/^[^:]+:\s*//; # Strip leading cruft; | |
$invite =~ s/\s*invited .*//; | |
my @invitees = split(/\n/,$invite); | |
foreach (@invitees) { | |
$_ = "Paul Fenwick" if $_ eq "You"; | |
say qq{ "$_" -> "$name";}; | |
} | |
# say "== $name (@invitees) =="; | |
} else { | |
next; | |
# say "== $name (source) =="; | |
} | |
if (not $name) { say "FAILED TO PARSE: \n$_\n"; } | |
} | |
say "}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment