36 lines
832 B
Python
36 lines
832 B
Python
|
import concurrent.futures
|
||
|
import requests
|
||
|
import sys
|
||
|
|
||
|
api_php = sys.argv[1]
|
||
|
|
||
|
def check_range(x):
|
||
|
r = requests.get(api_php, params={
|
||
|
'format': 'json',
|
||
|
'action': 'query',
|
||
|
'list': 'users',
|
||
|
'ususerids': '|'.join([str(z) for z in range(x-50, x)]),
|
||
|
})
|
||
|
for user in r.json().get('query', {}).get('users', []):
|
||
|
if 'missing' in user:
|
||
|
continue
|
||
|
if 'name' in user:
|
||
|
usern = user['name']
|
||
|
with open(f'usernames.txt', mode='a') as handle:
|
||
|
handle.write(usern + '\n')
|
||
|
print(usern)
|
||
|
|
||
|
|
||
|
|
||
|
def main():
|
||
|
with concurrent.futures.ThreadPoolExecutor(max_workers=200) as executor:
|
||
|
for x in range(1, 100000, 50)[1:]:
|
||
|
executor.submit(check_range, x)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|