I not long ago finished my project which comments on a video based on a keyword on YouTube, it will pick a random comment using the random library. The program has been acting strange when "randomizing" the comments to add to the YouTube videos. I'm starting to think I may need to improve the randomness, the fact being that it has chosen the 4th comment (out of 9) 7 times, and the 9th one 3 times. Both of these results occur after each other, in other words, it is sending the same message in a row when it's meant to pick randomly and not repeat. Is there any way I can increase how random this is? If you know, please do tell me, I will appreciate it a bunch!
PS: This is more of stopping it from repeating the same sentence on YouTube.
code:
if __name__ == "__main__":
from googleapiclient.errors import HttpError
import random
import time
import sys
# Comments are getting loaded
comments = load_comments('Comments.txt')
# Getting the number of comments you want to add
number_of_comments = int(input('Enter the number of comments: '))
count, cycle, videoid_store = 0, 1, []
# Getting the keyword
keyword = input('Enter the Keyword: ')
# This loop keeps running until all comments have been added
youtube = authentication()
while count < number_of_comments:
print("Searching for videos .. (Cycle:%d)" %cycle)
time.sleep(10)
random.shuffle(comments)
Aucun commentaire:
Enregistrer un commentaire