Your Name 3 gadi atpakaļ
vecāks
revīzija
2c4284d269
1 mainītis faili ar 19 papildinājumiem un 24 dzēšanām
  1. 19 24
      hhh/SEO/full_customer_seo.py

+ 19 - 24
hhh/SEO/full_customer_seo.py

@@ -35,7 +35,12 @@ def empty_query(q):
 
 
 def process_query(q):
-    global driver
+    options = webdriver.ChromeOptions()
+    options.add_argument("--proxy-server=socks5://172.104.67.159:8180")
+    driver = webdriver.Remote(
+        command_executor='http://127.0.0.1:4444/wd/hub',
+    desired_capabilities=options.to_capabilities())
+    driver.set_window_size(1400,1000)
     googleurl='https://www.google.com/search?q='+urllib.parse.quote(q)
     driver.get(googleurl)
     time.sleep(3)
@@ -53,6 +58,9 @@ def process_query(q):
                 webdriver.ActionChains(driver).move_to_element(elmt).perform()
                 webdriver.ActionChains(driver).move_to_element(elmt).click().perform()
                 break
+#    time.sleep(5)
+#    driver.quit()
+
 #    fw=codecs.open('c:/tmp/gg.html','w','utf-8')
 #    fw.write(driver.page_source)
 #    fw.close()
@@ -199,20 +207,20 @@ def gen_long():
         ds=r['designers']
         fullname=r['fullname']
         abvname=r['company']
-#        qlist.append(fullname)
-        qlist.append(fullname+"設計師")
-        qlist.append(fullname+" 設計師")
-        qlist.append(fullname+" 設計 師")
-        qlist.append(abvname+"設計師")
-#        qlist.append(abvname+" 設計師")
-        qlist.append(abvname+"費用")
-        qlist.append(abvname+"評價")
+        qlist.append(fullname)
+#        qlist.append(fullname+"設計師")
+#        qlist.append(fullname+" 設計師")
+#        qlist.append(fullname+" 設計 師")
+#        qlist.append(abvname+"設計師")
+##        qlist.append(abvname+" 設計師")
+#        qlist.append(abvname+"費用")
+#        qlist.append(abvname+"評價")
 #        qlist.append(abvname+" 費用")
 #        qlist.append(abvname+" 評價")
 #        qlist.append(abvname+"專線")
 #        qlist.append(abvname+"免費專線")
 #        qlist.append(abvname+"ptt")
-        qlist.append(abvname+" 設計 師")
+#        qlist.append(abvname+" 設計 師")
 
 #        qlist.append("幸福空間"+abvname)
 #        for d in ds:
@@ -258,19 +266,6 @@ time.sleep(10)
 # options.add_argument('--disable-logging')
 #driver = webdriver.Remote(desired_capabilities=options.to_capabilities())
 
-options = webdriver.ChromeOptions()
-options.add_argument("--proxy-server=socks5://172.104.67.159:8180")
-
-
-driver = webdriver.Remote(
-    command_executor='http://127.0.0.1:4444/wd/hub',
-#command_executor='http://192.53.174.202:4444/wd/hub',
-#command_executor='http://172.104.93.163:4444/wd/hub',
- 
-#command_executor='http://dev2.choozmo.com:14444/wd/hub',
-desired_capabilities=options.to_capabilities())
-#desired_capabilities=DesiredCapabilities.CHROME)
-driver.set_window_size(1400,1000)
 
 #https://whatismyipaddress.com/ip/61.230.75.30
 #driver.get('https://whatismyipaddress.com/')
@@ -298,7 +293,7 @@ while True:
     #    intsleep=random.randint(20,40)
 #    intsleep=random.randint(7,20)
 #    intsleep=random.randint(9,20)
-    intsleep=random.randint(60,150)
+    intsleep=random.randint(10,30)
 
 #    intsleep=random.randint(5,12)
 #    intsleep=random.randint(3,6)