From 6a2932eb1914c31717bd05c7d1edb225a1eaf24e Mon Sep 17 00:00:00 2001 From: ramjm Date: Fri, 26 Apr 2024 12:36:36 +0300 Subject: [PATCH] Update 'main.py' --- main.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index 4dad1b4..2a4799a 100644 --- a/main.py +++ b/main.py @@ -9,20 +9,24 @@ headers = { } # набор символов для генерации -alf = "0123456789" +alf = "abcdefghijklmnopqrstuvwxyz0123456789" +def main(): + with open("domens.txt", "a") as f: + # тут 3 цикла, для генерации 3-хсимвольного домена, а далее проверки на "is_available" + for x1 in alf: + for x2 in alf: + for x3 in alf: -with open("domens.txt", "w") as f: - # тут 3 цикла, для генерации 3-хсимвольного домена, а далее проверки на "is_available" - for x1 in alf: - for x2 in alf: - for x3 in alf: + json_data = {'domainList': f'["{x1+x2+x3}.pw"]'} + try: + response = requests.post('https://2domains.ru/wizard/api/domain/check', headers=headers, json=json_data).json()[0] + if (response["is_available"] == True): + f.write(f'{response["domain"]} - {response["price"]}\n') + print(f'{response["domain"]} - {response["price"]}') + except: + pass + f.write("==== DONE ====") - json_data = { - 'domainList': f'["{x1+x2+x3}.pw"]', - } - - response = requests.post('https://2domains.ru/wizard/api/domain/check', headers=headers, json=json_data).json()[0] - if (response["is_available"] == True): - f.write(f'{response["domain"]} - {response["price"]}\n') - print(f'{response["domain"]} - {response["price"]}') \ No newline at end of file +if __name__ == "__main__": + main() \ No newline at end of file