Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random, string
- #Where created IDs will go to be checked for duplicates as newer IDs get generated.
- usedID = []
- #Defining range of acceptable characters
- b64 = string.digits + string.ascii_uppercase + string.ascii_lowercase + "-" + "_"
- def generate(requested):
- count = 1
- for j in range (requested):
- output = ""
- while output not in usedID:
- for i in range(11):
- rNum = random.randint(0, 63)
- digit = str(b64[rNum])
- output += digit
- digit = ""
- if output not in usedID:
- usedID.append(output)
- usedID.sort()
- print("{}/{}: {}".format(count, requested, output))
- count = count + 1
- break
- req = int(input("Welcome! Type in a number to receive a custom amount of unique Base64 YouTube IDs!\n"))
- generate(req)
- print("Enjoy!")
Advertisement
Add Comment
Please, Sign In to add comment