Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Last active September 18, 2016 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpk/3533e7d8f6577747ff14eacc94bd5b78 to your computer and use it in GitHub Desktop.
Save aaronpk/3533e7d8f6577747ff14eacc94bd5b78 to your computer and use it in GitHub Desktop.
Example of extracting commenter names from the offline issues HTML from https://github.com/jreinhardt/handkerchief/pull/33
// https://github.com/indieweb/php-mf2/blob/master/Mf2/Parser.php
require_once 'Mf2/Parser.php';
$parsed = Mf2\parse(file_get_contents('issues-webmention.html'));
$authors = [];
foreach($parsed['items'][0]['children'] as $comment) {
$author = strtolower($comment['properties']['author'][0]);
if(!in_array($author, $authors))
$authors[] = $author;
}
sort($authors);
print_r($authors);
Array
(
[0] => aaronpk
[1] => aphillips
[2] => azaroth42
[3] => bblfish
[4] => bear
[5] => csarven
[6] => dissolve
[7] => domenicodefelice
[8] => dret
[9] => gobengo
[10] => gregorlove
[11] => hvdsomp
[12] => kevinmarks
[13] => kousu
[14] => mblaney
[15] => melvincarvalho
[16] => perlkonig
[17] => r12a
[18] => rhiaro
[19] => sandhawke
[20] => singpolyma
[21] => sknebel
[22] => snarfed
[23] => tantek
[24] => wilkie
[25] => willnorris
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment