Created
May 6, 2013 02:40
-
-
Save fabacab/5523089 to your computer and use it in GitHub Desktop.
Cross-reference data in the FetLife Alleged Abusers Database Engine against the the live FetLife site to determine which users accused of violating consent are also paying supporters of FetLife.com. (Output is provided on STDOUT as CSV data, ready for importing to a data analysis tool, such as a spreadsheet. Script progress is reported on STDERR…
This file contains hidden or 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
<?php | |
// You need to use the FetLife.php library available at GitHub, here: | |
// https://github.com/meitar/libFetLife/blob/fbf4123eb1682369d8a4ad86011b87e3717297af/FetLife.php | |
require_once 'libFetLife/FetLife.php'; | |
if (!defined('STDIN') || !defined('STDERR')) { die('Please run this from the command line.'); } | |
// Obviously(?) replace the USERNAME with a username that can log in to FetLife, and the PASSWORD with that user's password. | |
$FL = new FetLifeUser('USERNAME', 'PASSWORD'); | |
// Uncomment this next line to use a local SOCKS proxy, like Tor. | |
//$FL->connection->setProxy('localhost:9050', CURLPROXY_SOCKS5); | |
$FL->logIn() or die("Could not log in. Last HTML received was: {$FL->connection->cur_page}"); | |
// Initialize the variables we're interested in. | |
$total_faade_reports = 0; | |
$fl_members_reported = array(); | |
// Get the FAADE database in comma-separated values format. | |
$fh = fopen('https://docs.google.com/spreadsheet/pub?key=0ArYmNHuRadHbdGNVT1kzSzFnOXhHRjh1RnczZVVmMXc&output=csv', 'r'); | |
while (($data = fgetcsv($fh)) !== false ) { | |
$id = (int) $data[1]; | |
if (!$id) { continue; } // Ignore reports without numeric user IDs. | |
$fl_members_reported[] = $id; | |
$total_faade_reports++; | |
} | |
fclose($fh); | |
fwrite(STDERR, "Total FAADE reports: $total_faade_reports\n"); | |
$x = count(array_unique($fl_members_reported)); | |
fwrite(STDERR, "Total unique FetLife members reported: $x\n"); | |
$paid_fl_members_reported = array(); | |
$i = 1; | |
foreach (array_unique($fl_members_reported) as $id) { | |
fwrite(STDERR, "Fetch number $i, profile for reported user ID $id..."); | |
$profile = $FL->getUserProfile($id); | |
if ($profile->isPayingAccount()) { | |
fwrite(STDERR, "which is a paid account!"); | |
fwrite(STDOUT, "$id,{$profile->nickname},{$profile->age},{$profile->gender},{$profile->role}\n"); | |
$paid_fl_members_reported[] = $id; | |
} | |
fwrite(STDERR, "\n"); | |
$i++; | |
} | |
$x = count(array_unique($paid_fl_members_reported)); | |
fwrite(STDERR, "Total unique PAID FetLife members with FAADE reports: $x\n"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment