Adjust to changes in the API.
Created a test for https://bugzilla.wikimedia.org/show_bug.cgi?id=43082 (does not pass at this moment in master).