[Membership 2 Pro] Get list of members programatically

We used to use the following code to get a list of current members, however it no longer works. I’m looking for any reference on how to do this with the current plugin version.

require_once( membership_dir( 'membershipincludes/classes/class.membersearch.php' ) );

$active_op = true;
$heroes = new M_Member_Search($usersearch, $userspage, $sub_id, $level_id, $active_op);
$heroes->query_vars['number'] = 10000;
$exclude = array(188,975,1071,15,1067,1278,47,166); //test account ID's
$heroes->query_vars['exclude'] = $exclude;