check if instagram name is available code example

Example: instagram username checker

import requests
import random
import time
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

f = open("username_text_file.txt", "r") # create a text file with the usernames you want to check
data = f.readlines()

for un in data:
    time.sleep(1 * random.random())
    url = "https://www.instagram.com/"+str(un[:4])
    x = requests.get(url, verify = False)
    if x.status_code == 200:
        print("skip - " + un[:4]+ " - "+ str(data.index(un)))
    else:
        print("available - " + un[:4] + " - "+ str(data.index(un)))
        f2 = open("available_usernames.txt", "a") # create a blank text file and it'll insert all the available usernames in there so you can check later
        f2.write(un)
        f2.close()
    if int(data.index(un))%20 == 0:
        time.sleep(5)