|
@@ -43,12 +43,12 @@ def open_driver():
|
|
|
return driver
|
|
|
|
|
|
|
|
|
-def comment_page(driver, urls, comment):
|
|
|
+def comment_page(driver, url, comment):
|
|
|
if len(urls) == 0:
|
|
|
print('Youtube Comment Bot: Finished!')
|
|
|
return []
|
|
|
|
|
|
- url = urls.pop()
|
|
|
+ # url = urls.pop()
|
|
|
|
|
|
driver.get(url)
|
|
|
print(url)
|
|
@@ -80,8 +80,8 @@ def comment_page(driver, urls, comment):
|
|
|
|
|
|
r = np.random.randint(2, 5)
|
|
|
time.sleep(r)
|
|
|
-
|
|
|
- return comment_page(driver, urls, random_comment())
|
|
|
+ driver.quit()
|
|
|
+ return comment_page(driver, url, random_comment())
|
|
|
|
|
|
|
|
|
def random_comment():
|
|
@@ -111,11 +111,11 @@ if __name__ == '__main__':
|
|
|
js = r.get('yt_video')
|
|
|
jsobj = json.loads(js)
|
|
|
videoId = random.choice(jsobj)
|
|
|
- urls = f"https://www.youtube.com/watch?v={videoId}"
|
|
|
+ url = f"https://www.youtube.com/watch?v={videoId}"
|
|
|
|
|
|
# inp = open("url.txt", "r")
|
|
|
# for line in inp.readlines():
|
|
|
# urls.append(line)
|
|
|
|
|
|
driver = open_driver()
|
|
|
- comment_page(driver, urls, random_comment())
|
|
|
+ comment_page(driver, url, random_comment())
|