Skip to content

Instantly share code, notes, and snippets.

@pjf
Created November 26, 2012 00:49
Show Gist options
  • Save pjf/4146046 to your computer and use it in GitHub Desktop.
Save pjf/4146046 to your computer and use it in GitHub Desktop.
Turns event invite information into graphviz files
#!/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