In this article, we will create a youtube bot using Selenium and
Python which will increase view count of your video, but let me tell you
one thing from right the beginning The BOT should not be actually used
it is just for educational purpose as if the algorithm is used it will
work for some time but soon the youtube algorithm will realize that
something dodgy is going on and will do something.
NOTE:
The bot will not generate view in the long term it is jus a small fun project please don't abuse it!
Requirements:
Python
Selenium
Chrome webdriver(for selenium to communicate with browser)
After
installing all the requirements, let's just go into coding part, first
of all, we will import all the required libraries that we gonna use in
our script
from selenium import webdriver
import time
from random import randrange
Next we craete a refresh_time variabe and assign it the time after which you want to refresh the video
refresh_time = 10
browser_list = []
We create three instance
of webdriver class and pass the executable path of your webdriver and
append them inside a list (browser_list) to switch to diffrent browser
randomly.
browser_one = webdriver.Chrome("executable path of webdriver")
browser_two = webdriver.Chrome("executable path of webdriver")
browser_three = webdriver.Chrome("executable path of webdriver")
browser_list.append(browser_one)
browser_list.append(browser_two)
browser_list.append(browser_three)
Next we provide link of the video to each browser, we use for loop to execute this process
for browser in browser_list:
browser.get("link of your video")
Now
we create an infinite while loop and create a variable browser_name
which handles which browser is to be refreshed and it is done randomly
and print's the refreshed browser
while(True):
browser_num = randrange(0, len(browser_list))
browser_list[browser_num].refresh()
print("browser number", browser_num, "refreshed")
time.sleep(refresh_time)
Atlast, we close our browser. and that's all
FULL CODE:
from selenium import webdriver
import time
from random import randrange
refresh_time = 10
browser_list = []
browser_one = webdriver.Chrome("executable path of webdriver")
browser_two = webdriver.Chrome("executable path of webdriver")
browser_three = webdriver.Chrome("executable path of webdriver")
browser_list.append(browser_one)
browser_list.append(browser_two)
browser_list.append(browser_three)
for browser in browser_list:
browser.get("link of your video")
while(True):
browser_num = randrange(0, len(browser_list))
browser_list[browser_num].refresh()
print("browser number", browser_num, "refreshed")
time.sleep(refresh_time)
browser.close()
Comments