|
@@ -18,21 +18,21 @@ import time
|
|
|
import traceback
|
|
|
import sys
|
|
|
import fire
|
|
|
-def init_browser():
|
|
|
- os.system('docker container restart proxy1')
|
|
|
- os.system('docker container restart tiny1')
|
|
|
+def init_browser(proxy1='proxy1',tiny1='tiny1',socks5="9050",debug='9922'):
|
|
|
+ os.system('docker container restart '+proxy1)
|
|
|
+ os.system('docker container restart '+tiny1)
|
|
|
|
|
|
time.sleep(10)
|
|
|
options = webdriver.ChromeOptions()
|
|
|
options.add_argument('--headless')
|
|
|
- options.add_argument('--proxy-server=socks5://127.0.0.1:9050')
|
|
|
+ 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_experimental_option("debuggerAddress", "127.0.0.1:9922")
|
|
|
+ options.add_experimental_option("debuggerAddress", "127.0.0.1:"+debug)
|
|
|
|
|
|
# options.add_experimental_option("debuggerAddress", "192.168.192.45:9922")
|
|
|
# options.add_experimental_option("debuggerAddress", q[2])
|
|
@@ -48,14 +48,30 @@ def init_browser():
|
|
|
print(q)
|
|
|
process_query(q)
|
|
|
|
|
|
-driver=init_browser()
|
|
|
-#driver.get('https://www.youtube.com/watch?v=K5DEJXajtqA')
|
|
|
-driver.get('https://www.youtube.com/watch?v=_N0VneVhkoQ')
|
|
|
|
|
|
-video = driver.find_element_by_id('movie_player')
|
|
|
-video.send_keys(Keys.SPACE) #hits space
|
|
|
-time.sleep(1)
|
|
|
-video.click() #mouse click
|
|
|
|
|
|
-time.sleep(31)
|
|
|
+
|
|
|
+
|
|
|
+class JParams(object):
|
|
|
+
|
|
|
+ def get(self, yt,proxy1,tiny1,socks5,debug):
|
|
|
+ driver=init_browser(proxy1='proxy1',tiny1='tiny1',socks5="9050",debug='9922')
|
|
|
+ #driver.get('https://www.youtube.com/watch?v=K5DEJXajtqA')
|
|
|
+ driver.get('https://www.youtube.com/watch?v='+yt)
|
|
|
+
|
|
|
+ video = driver.find_element_by_id('movie_player')
|
|
|
+ video.send_keys(Keys.SPACE) #hits space
|
|
|
+ time.sleep(1)
|
|
|
+ video.click() #mouse click
|
|
|
+
|
|
|
+ time.sleep(31)
|
|
|
+
|
|
|
+
|
|
|
+ print('kw')
|
|
|
+ print(domain)
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ fire.Fire(JParams)
|
|
|
+
|
|
|
|