Coder Social home page Coder Social logo

discordusernameavailabilitychecker's People

Contributors

kirby1997 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

discordusernameavailabilitychecker's Issues

Requests is not a module?

Import requests does not work.
, line 2, in <module> import requests ModuleNotFoundError: No module named 'requests'.
It is installed, though:
Requirement already satisfied: request in [my path].

was trying to add proxy support to the code, but imma noob. Let me know if this helps or you can help me figure this out.

import time
import requests
import requests

Set the Discord authorization token

token = "" # INSERT YOUR TOKEN INTO THE QUOTES. DO NOT SHARE THIS TOKEN.

IF SHARING THIS FILE, REMEMBER TO REMOVE YOUR TOKEN

headers = {"Authorization": token}

with open("proxies.txt") as proxy:
proxies = [line.strip() for line in proxy]

Discord username API endpoint

endpoint = "https://discord.com/api/v10/users/@me/pomelo"

Load the list of usernames from the file

with open("usernames.txt") as file:
usernames = [line.strip() for line in file]

available_usernames = []

Loop through each username in the list and check availability

for username in usernames:
url = endpoint
body = {
"username": username
}
response = requests.post(url, headers=headers, json=body, proxies={"http": proxies, "https":proxies},timeout=3)

# Rate limit check
if response.status_code == 429:
    sleep_time = response.json()["retry_after"]
    print(f"Rate limit hit. Sleeping for {sleep_time}s")
    time.sleep(sleep_time)
    response = requests.post(url, headers=headers, json=body, proxies=proxies)

#username available check
if response.json()['code'] == 40001:
    print(f"{username} is available")
    available_usernames.append(username)

#Username unavailable check
elif response.json()['code'] == 50035:
    print(f"{username} is taken")

#Some other error
else:
    print(f"Error checking {username}: {response.json()['message']}")

Write available usernames to a file

with open("available_usernames.txt", "w") as file:
file.write("\n".join(available_usernames))

Endpoint don't work anymore

Hey, so i was trying to check some usernames but every time it's marked as not taken but even with a username that i know is taken is still marked as not taken by your script

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.