|
@@ -12,7 +12,7 @@ from selenium.webdriver.common.keys import Keys
|
|
|
from selenium.common.exceptions import NoSuchElementException
|
|
|
from selenium_stealth import stealth
|
|
|
|
|
|
-
|
|
|
+profile_file = ['Profile 20', 'Profile 25']
|
|
|
|
|
|
|
|
|
def open_driver():
|
|
@@ -21,11 +21,12 @@ def open_driver():
|
|
|
# op.add_argument('--headless')
|
|
|
op.add_argument('--disable-dev-shm-usage')
|
|
|
op.add_argument('--no-sandbox')
|
|
|
- op.add_argument('user-data-dir=/Users/zooeytsai/Library/Application Support/Google/Chrome/')
|
|
|
- op.add_argument('profile-directory=Profile 3')
|
|
|
+ op.add_argument(r'user-data-dir=C:\Users\Administrator\AppData\Local\Google\Chrome\User Data')
|
|
|
+ op.add_argument('profile-directory=Profile 20')
|
|
|
op.add_experimental_option("excludeSwitches", ["enable-automation"])
|
|
|
op.add_experimental_option('useAutomationExtension', False)
|
|
|
- driver = webdriver.Chrome(options=op,executable_path=r'/Users/zooeytsai/Downloads/chromedriver 2')
|
|
|
+ driver = webdriver.Chrome(options=op,
|
|
|
+ executable_path=r'C:\Users\Administrator\Downloads\chromedriver_win32 (4)\chromedriver')
|
|
|
# stealth(driver,
|
|
|
# languages=["en-US", "en"],
|
|
|
# vendor="Google Inc.",
|
|
@@ -36,7 +37,7 @@ def open_driver():
|
|
|
# )
|
|
|
time.sleep(5)
|
|
|
# driver.get("https://www.youtube.com/watch?v=eFZckOTi24c")
|
|
|
-
|
|
|
+
|
|
|
# driver.find_element(By.XPATH,'// *[ @ id = "openid-buttons"] / button[1]').click()
|
|
|
time.sleep(1000)
|
|
|
return driver
|
|
@@ -106,10 +107,10 @@ if __name__ == '__main__':
|
|
|
urls = [
|
|
|
'https://www.youtube.com/watch?v=eFZckOTi24c',
|
|
|
]
|
|
|
-
|
|
|
+
|
|
|
# inp = open("url.txt", "r")
|
|
|
# for line in inp.readlines():
|
|
|
# urls.append(line)
|
|
|
-
|
|
|
+
|
|
|
driver = open_driver()
|
|
|
comment_page(driver, urls, random_comment())
|