samedi 9 janvier 2021

Random Module Not Fully Randomizing

I have made a script that comments on a youtube video based on a keyword and it heavily relies on the Random module to ensure that all comments are not the same. This is important as some comments are getting hidden for being the same on multiple videos. (I tested it 5 mins ago and it chose the same comment 6 times!)

# Comments are getting loaded
    comments = load_comments('Comments.txt')
    # Getting the number of comments you want to added on new videos
    number_of_comments = int(input('Enter the number of comments: '))
    count, cycle, videoid_store = 0, 1, []
    # Getting the keyword which will find you the videos
    keyword = input('Enter the Keyword: ')
    
    
    # waiting for comments to be added
    youtube = authentication()
    while count < number_of_comments:
        
        print("Searching for videos ..")
        time.sleep(10)
        
        random.shuffle(comments)

This is using the YouTube v3 API to perform the actions, is there any way to make it not comment the same thing more than 3 times? Or a better way to randomize the comments?




Aucun commentaire:

Enregistrer un commentaire