Last active
September 18, 2016 15:24
-
-
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
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
// 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); |
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
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