Jared 2 years ago
parent
commit
9f5ee77b32
1 changed files with 6 additions and 3 deletions
  1. 6 3
      choozmo/watch_yt.py

+ 6 - 3
choozmo/watch_yt.py

@@ -18,9 +18,14 @@ import time
 import traceback
 import sys
 import fire
+from userAgentRandomizer import userAgents
+
+
 def init_browser(proxy1='proxy1',tiny1='tiny1',socks5="9050",debug='9922',cdriver=''):
     os.system('docker container restart '+proxy1)
     os.system('docker container restart '+tiny1)
+    ua = userAgents()
+    user_agent = ua.random()        
 
     time.sleep(12)
     options = webdriver.ChromeOptions()
@@ -28,9 +33,7 @@ def init_browser(proxy1='proxy1',tiny1='tiny1',socks5="9050",debug='9922',cdrive
     options.add_argument('--proxy-server=socks5://127.0.0.1:'+socks5)
     options.add_argument('--disable-dev-shm-usage')
     options.add_argument('--no-sandbox')
-#    options.add_argument('--remote-debugging-port=9222')
-
-#    epath=os.environ['WEBDRIVER']
+    options.add_argument("--user-agent=" +user_agent)
 
     options.add_experimental_option("debuggerAddress", "127.0.0.1:"+debug)