I am new to python and still learning.
I am just playing around with small scripts I am creating for fun to learn, here is what I got.
from selenium import webdriver
import time
import random
driver = webdriver.Chrome("C:\\Users\\16239\\youtubebot\\chromedriver")
videos = [
"https://www.youtube.com/watch?v=COAdbTDTDFc"
"https://www.youtube.com/watch?v=p_2wemVUQnc"
"https://www.youtube.com/watch?v=A8fODOFiBq0"
"https://www.youtube.com/watch?v=tmgT01e1sGQ"
"https://www.youtube.com/watch?v=_eqEuBp3jJw"
"https://www.youtube.com/watch?v=09IRNL2TsHM"
"https://www.youtube.com/watch?v=uUIugt-GsbY"
"https://www.youtube.com/watch?v=HqlBwWX218s"
"https://www.youtube.com/watch?v=DrKafd3U4TY"
]
random_video = random.randint(0,8)
sleep_time = random.randint(60,120)
for i in range(7000):
print("Running the Video for {} time".format(i))
driver.get(videos[random_video])
time.sleep(sleep_time)
driver.quit()
the issue is when I run it I am getting the error.
driver.get(videos[random_video])
IndexError: list index out of range
I have 9 in the videos list and the random_video variable is calling 0 - 8 and I cant figure out the error. please help