|
@@ -0,0 +1,245 @@
|
|
|
+from selenium import webdriver
|
|
|
+from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
|
|
+import time
|
|
|
+import os
|
|
|
+import urllib.parse
|
|
|
+from selenium.webdriver.support.ui import WebDriverWait
|
|
|
+from selenium.webdriver.common.by import By
|
|
|
+from selenium.webdriver.support import expected_conditions as EC
|
|
|
+import codecs
|
|
|
+import random
|
|
|
+from bs4 import BeautifulSoup
|
|
|
+import requests
|
|
|
+import time
|
|
|
+import rpyc
|
|
|
+import sys
|
|
|
+import docker
|
|
|
+
|
|
|
+headers = {
|
|
|
+ "Authorization": "Bearer " + "t35vhZtWNgvDNWHc3DJh0OKll3mcB9GvC8K2EAkBug2",
|
|
|
+ "Content-Type": "application/x-www-form-urlencoded"
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+def send_msg(kw):
|
|
|
+ params = {"message": "處理關鍵字: "+kw}
|
|
|
+ r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
+
|
|
|
+
|
|
|
+def empty_query(q):
|
|
|
+ global driver
|
|
|
+ googleurl='https://www.google.com/search?q='+urllib.parse.quote(q)
|
|
|
+ driver.get(googleurl)
|
|
|
+ time.sleep(3)
|
|
|
+
|
|
|
+
|
|
|
+def process_query(q):
|
|
|
+ global driver
|
|
|
+ googleurl='https://www.google.com/search?q='+urllib.parse.quote(q)
|
|
|
+ driver.get(googleurl)
|
|
|
+ time.sleep(3)
|
|
|
+
|
|
|
+ elmts=driver.find_elements_by_xpath("//div[@class='g']//div[@class='yuRUbf']//a")
|
|
|
+ idx=1
|
|
|
+ ranking=-1
|
|
|
+ for elmt in elmts:
|
|
|
+ href=elmt.get_attribute('href')
|
|
|
+ txt=elmt.text
|
|
|
+ if len(txt)>10:
|
|
|
+# if 'hhh.com.tw' in href:
|
|
|
+ if 'hhh.com.tw' in href:
|
|
|
+# if 'searchome.net' in href:
|
|
|
+ webdriver.ActionChains(driver).move_to_element(elmt).perform()
|
|
|
+ webdriver.ActionChains(driver).move_to_element(elmt).click().perform()
|
|
|
+ break
|
|
|
+# fw=codecs.open('c:/tmp/gg.html','w','utf-8')
|
|
|
+# fw.write(driver.page_source)
|
|
|
+# fw.close()
|
|
|
+
|
|
|
+# driver.save_screenshot("c:/tmp/screen.png")
|
|
|
+# os.startfile("c:/tmp/screen.png")
|
|
|
+# driver.quit()
|
|
|
+#KPI: IS國際設計(293)陳嘉鴻
|
|
|
+# 浩室設計(278) 富億設計(31) 豐聚設計(24) 上築設計(594) 京璽國際(356) 摩登雅舍(307) 優尼客(491) 比沙列(33) 亞維(385)
|
|
|
+# /designers/cases/(491|31|293|278|31|24|594|356|307|491|33|385)
|
|
|
+#qlist=['上築空間設計','豐聚室內裝修','富億空間設計','浩室設計','京璽國際','IS國際設計','優尼客','摩登雅舍','亞維空間設計','比沙列','富億設計','豐聚設計']
|
|
|
+#qlist=['IS國際設計']
|
|
|
+#qlist=['YHS DESIGN','齊舍設計','奧立佛竺居','阿曼空間設計','界陽大司室內設計','尚藝室內裝修','禾禾設計','上陽設計','苡希創意設計','羽筑空間設計','將作空間']
|
|
|
+#qlist=['富億空間','幸福空間節目 富億','幸福空間設計師 富億','幸福空間 富億','幸福空間 fe設計','老屋 富億','老屋翻新 富億','天井設計案例 富億','IS國際設計','豐聚設計','浩室設計','優尼客','摩登雅舍','亞維空間設計','比沙列','京璽國際','上築空間設計']
|
|
|
+#qlist+=['合砌設計','羽筑空間設計','朱英凱室內設計','將作空間','藝谷空間','文儀室內裝修','維耕設計','亞維空間設計','比沙列','上築空間設計','京璽國際','IS國際設計','優尼客','摩登雅舍','玖柞設計','麻石設計','元典設計','大琚空間','惹雅國際','橙果創意','PLSB建境','聯寬室內裝修']
|
|
|
+#qlist+=['合砌設計','羽筑空間設計','朱英凱室內設計','將作空間','藝谷空間','文儀室內裝修','維耕設計','亞維空間設計','比沙列','上築空間設計','京璽國際','IS國際設計','優尼客','摩登雅舍','玖柞設計','麻石設計','元典設計','大琚空間','惹雅國際','橙果創意','PLSB建境','聯寬室內裝修']
|
|
|
+
|
|
|
+#qlist=['卓林室內設計','成綺空間設計','德本迪設計','昱森室內設計','千綵胤空間設計','上築空間設計']
|
|
|
+#qlist=['IS國際設計','IS國際設計','IS國際設計 陳嘉鴻','IS國際設計 費用','IS國際設計 陳嘉鴻','IS國際設計 風格','IS國際設計 接案風格','IS國際設計 現代風','IS國際設計 老屋翻新']
|
|
|
+
|
|
|
+#qlist=['IS國際設計','陳嘉鴻設計師設計費','陳嘉鴻設計師','陳嘉鴻 費用','IS國際設計 陳嘉鴻','幸福空間陳嘉鴻設計師','陳嘉鴻設計師評價','is國際設計ptt']
|
|
|
+#qlist=['黃翊峰','林峰安 幸福空间','幸福空間王思文作品','黃仲均','鄭抿丹','張德良收費','周彥如','演拓設計費','演拓設計收費','邱郁雯','簡瑋琪','張靜峰設計費','周彥如設計師','陳錦樹設計師']
|
|
|
+#qlist=['張靜峰設計師','伊太設計','is設計','比沙列室內裝修設計有限公司','陳嘉鴻設計師設計費','澄境室內設計','上築空間設計','比沙列設計','魏子涵']
|
|
|
+#qlist=['京璽 幸福空間','澄境 幸福空間','雅舍王 幸福空間','豐聚設計 幸福空間','演拓設計評價 幸福','豐聚室內裝修設計','浩室 幸福','張德良評價']
|
|
|
+#qlist=['幸福空間 魏子涵','豐聚室內裝修設計有限公司','水設設計ptt','室設計','設計鬼才','築空間設計']
|
|
|
+#qlist+=['奧立佛 設計師 鍾鼎','奧立佛 老屋翻新','奧立佛 住宅改造','奧立佛 監工費','奧立佛 設計 鍾黎']
|
|
|
+
|
|
|
+#qlist=['王思文','陳嘉鴻設計師','星葉設計','邱郁雯','演拓設計收費','簡瑋琪','張靜峰設計師','伊太空間設計','伊太']
|
|
|
+
|
|
|
+#qlist=['富億空間設計','富億空間設計 新成屋','富億空間設計 新成屋','富億空間設計 老屋翻新','富億空間設計 陳錦樹','富億空間設計 設計師','富億空間設計 室內設計','富億空間設計 室內設計師']
|
|
|
+#qlist+=['富億空間 新成屋','富億空間 新成屋','老屋翻新','富億空間 陳錦樹','富億空間 設計師','富億空間 室內設計']
|
|
|
+#qlist=['富億設計','富億設計 新成屋','富億設計 新成屋','富億設計 老屋翻新','富億設計 陳錦樹','富億設計 設計師','富億設計 室內設計','富億設計 室內設計師']
|
|
|
+
|
|
|
+
|
|
|
+#qlist=['豐聚設計','豐聚設計 黃翊峰','豐聚設計 李羽芝','豐聚設計 休閒風','豐聚設計 現代風','豐聚設計 工業風','豐聚設計 設計大獎']
|
|
|
+#qlist=['京璽國際','京璽國際 周彥如','京璽國際 設計師','京璽國際 現代風','京璽國際 美式風','京璽國際 奢華風','京璽國際 新成屋']
|
|
|
+#qlist=['合砌設計','合砌設計 臺北市','合砌設計 南港區','合砌設計 忠孝東路','合砌設計 簡約','合砌設計 現代風','合砌設計 徐俊福']
|
|
|
+#qlist=['朱英凱室內設計','朱英凱室內設計 室內設計','朱英凱室內設計 國際大賞','朱英凱室內設計 GLORY','朱英凱室內設計 動線','朱英凱室內設計 設計費','朱英凱室內設計 毛坯屋']
|
|
|
+#qlist=['演拓設計','演拓設計 殷崇淵','演拓設計 張德良','演拓設計 楊霈瀅','演拓設計 寬寬','演拓設計 廖文祥','演拓設計 設計裝潢']
|
|
|
+#qlist=['玖柞設計','玖柞設計 朱伯晟','玖柞設計 蔡雅怡','玖柞設計 新宅','玖柞設計 室內設計','玖柞設計 建築','玖柞設計 裝潢設計']
|
|
|
+#qlist=['摩登雅舍','摩登雅舍 汪忠錠','摩登雅舍 王思文','摩登雅舍 室內裝修','摩登雅舍 手作牆','摩登雅舍 浮雕','摩登雅舍 南歐']
|
|
|
+#qlist=['亞維設計','亞維設計 簡瑋琪','亞維空間設計','亞維設計 居家室內設計','亞維設計 老屋翻新','亞維設計 軟裝','亞維設計 鄉村風']
|
|
|
+#qlist=['富億設計 富億營造','富億設計 新成屋','富億設計 老屋翻新','富億設計 陳錦樹','富億設計 設計師','富億設計 室內設計','富億設計 室內設計師']
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+#qlist+=['卓林室內設計','卓林設計 林繹寬','卓林設計 設計師','卓林設計 機能宅','卓林設計 室內設計','卓林 室內設計','卓林設計 坪效','卓林設計 空間設計']
|
|
|
+#qlist=['德本迪 宜荷','德本迪 室內設計','德本迪 裝修','德本迪 宋雯鈴','德本迪 宋志鍾','德本迪 室內設計諮詢','德本迪 系統家具']
|
|
|
+#接案風格:現代風/古典風/休閒風/低調奢華/新古典。接案類型:小坪數/標準格局/別墅/大坪數/老屋翻新/樓中樓/實品/樣品屋/商業空間/挑高樓層。老屋翻新欲了解陳嘉鴻設計師價格? 到幸福空間看更多PTT、mobile01版友好評推薦的 is國際設計-陳嘉鴻設計師計費及作品。
|
|
|
+
|
|
|
+#qlist=['plsb建境 構建築','plsb建境 plsb','plsb建境 室內設計','plsb建境 空間設計','plsb建境 專線','plsb建境 專線']
|
|
|
+#qlist+=['界陽室內設計','界陽大司室內設計','界陽x大司','界陽大司 馬健凱設計師','界陽大司 設計師','界陽大司 設計風格']
|
|
|
+
|
|
|
+#qlist+=['馮澤森 構建築','馮澤森 plsb','馮澤森 室內設計','馮澤森 空間設計','馮澤森 專線','馮澤森 專線']
|
|
|
+#qlist=['馮澤森 構建築','馮澤森 plsb','馮澤森 室內設計','馮澤森 空間設計','馮澤森 專線','馮澤森 專線']
|
|
|
+#
|
|
|
+#qlist=['plsb建境 建築設計師','建築設計師 plsb','plsb建境 建築設計師','plsb建境 建築設計師','plsb建境 建築設計公司','plsb建境 建築設計公司']
|
|
|
+
|
|
|
+#qlist=['富億設計','富億設計 費用','富億設計 費用 評價','富億設計 評價','富億設計 室內設計','富億設計 設計師','富億設計 電話','富億設計 傳真']
|
|
|
+#qlist=['浩室設計','浩室設計 費用','浩室設計 費用 評價','浩室設計 評價','浩室設計 室內設計','浩室設計 設計師','浩室設計 邱炫達','浩室設計 無縫接案','浩室設計 室設計']
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+#qlist=['優尼客設計','優尼客設計 空間設計','優尼客設計 設計','優尼客設計 黃仲均','優尼客設計 室內設計師','優尼客設計 現代風','優尼客設計 北歐風','優尼客設計 工業風']
|
|
|
+#qlist=['界陽大司','界陽大司 空間設計','界陽大司 設計','界陽大司 馬健凱','界陽大司 室內設計師','界陽大司 案例','界陽大司 室內設計獎']
|
|
|
+
|
|
|
+
|
|
|
+#qlist=['安喆空間設計','安喆 空間設計','安喆空間設計 專線','安喆空間設計 陳佳暄','安喆空間設計 林威任','安喆空間設計 桃園','安喆空間設計 公司地址']
|
|
|
+#qlist=['奧立佛竺居 設計師 鍾鼎','奧立佛竺居 老屋翻新','奧立佛竺居 住宅改造','奧立佛竺居 監工費','奧立佛竺居 設計 鍾黎','奧立佛竺居 謝雨竹']
|
|
|
+
|
|
|
+
|
|
|
+#qlist=['亞維設計免費專線','亞維設計 0809','亞維設計設計師','亞維設計主題','亞維設計 媒體報導','上築設計免費專線','上築設計設計師','上築設計 0809','上築設計獎項','浩室設計免費專線','浩室設計 0809','浩室設計設計師','浩室設計主題','富億設計免費專線','富億設計設計師','富億設計主題','豐聚設計免費專線','豐聚設計設計師','豐聚設計獎項']
|
|
|
+#qlist=['陳嘉鴻 設計師 幸福','幸福空間 陳嘉鴻','京璽國際 免費專線','京築聯合','京璽國際 京築','星葉設計','築空間設計','水設設計評價','京璽 周彥如','京璽國際 風水','京璽國際 小坪數','京璽國際 幸福','京璽 設計師 免費專線']
|
|
|
+#qlist=['設計師','裝潢','室內設計','室內設計師','設計師 小坪數','裝潢 小坪數','室內裝修']
|
|
|
+#豐聚室內裝修設計
|
|
|
+#,'IS國際設計電話','富億設計電話','富億設計設計師']
|
|
|
+
|
|
|
+#qlist=['陳嘉鴻 室內設計','裝潢','室內設計','室內設計師','設計師 小坪數','裝潢 小坪數','室內裝修']
|
|
|
+#qlist=['陳嘉鴻 室內設計','馮澤森 室內設計','黃翊峰 室內設計','簡瑋琪 室內設計','朱英凱 室內設計','李羽芝 室內設計','周彥如 室內設計']
|
|
|
+#qlist=['室內設計師','富億空間設計']
|
|
|
+#qlist=['亞維空間設計','簡瑋琪','亞維設計','亞維','簡瑋琪設計師','亞麋廚房']
|
|
|
+#qlist+=['幸福空間簡瑋琪','幸福空間亞維設計','幸福空間亞維','幸福空間盧慧珊','幸福空間汪忠錠','幸福空間王思文']
|
|
|
+
|
|
|
+#qlist=['陳嘉鴻設計師價格','陳嘉鴻設計師評價','IS國際設計價格','IS國際設計評價']
|
|
|
+#qlist+=['德本迪設計','德本迪設計 宜荷','德本迪設計 室內設計','德本迪設計 裝修','德本迪設計 宋雯鈴','德本迪設計 宋志鍾','德本迪設計 室內設計諮詢','德本迪設計 系統家具']
|
|
|
+
|
|
|
+#qlist+=['幸福空間陳錦樹','幸福空間富億設計','幸福空間富億']
|
|
|
+#qlist+=['盧慧珊 室內設計','豪宅 室內設計','浩室設計 室內設計','客廳室內設計','富億 客廳室內設計']
|
|
|
+#qlist=['黃仲均設計師','摩登雅舍室內設計','浩室設計有限公司','幸福空間 魏子涵','幸福空間王思文作品','張靜峰設計師','周彥如設計師']
|
|
|
+#qlist+=['黃仲均','幸福空間黃仲均','幸福空間設計師黃仲均','幸福空間優尼客']
|
|
|
+
|
|
|
+#qlist+=['幸福空間陳嘉鴻','幸福空間IS國際','幸福空間IS','幸福空間設計師陳嘉鴻']
|
|
|
+#qlist=['上築空間裝潢','上築裝潢','上築空間魏子涵','幸福空間魏子涵','上築空間設計','上築空間設計魏子涵']
|
|
|
+#conn = rpyc.classic.connect("192.53.174.202",18812)
|
|
|
+#conn.execute('import os')
|
|
|
+#ros = conn.modules.os
|
|
|
+#ros.system('docker restart 62eab82f7759')
|
|
|
+#print('after restart')
|
|
|
+#time.sleep(11)
|
|
|
+#print('after wait')
|
|
|
+
|
|
|
+client = docker.from_env()
|
|
|
+ls=client.containers.list()
|
|
|
+print(ls)
|
|
|
+ls[0].restart()
|
|
|
+
|
|
|
+#os.system('docker restart 8dd59fd0a019')
|
|
|
+time.sleep(10)
|
|
|
+#from selenium import webdriver
|
|
|
+#PROXY = "23.23.23.23:3128" # IP:PORT or HOST:PORT
|
|
|
+#chrome_options = webdriver.ChromeOptions()
|
|
|
+#chrome_options.add_argument('--proxy-server=%s' % PROXY)
|
|
|
+#options.add_argument("--proxy-server=socks5://" + host + ":" + port);
|
|
|
+#chrome = webdriver.Chrome(options=chrome_options)
|
|
|
+#chrome.get("http://whatismyipaddress.com")
|
|
|
+
|
|
|
+
|
|
|
+#from selenium import webdriver
|
|
|
+#options = webdriver.ChromeOptions()
|
|
|
+# set some options
|
|
|
+# for example:
|
|
|
+# 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/')
|
|
|
+#fw=codecs.open('c:/tmp/gg.html','w','utf-8')
|
|
|
+#fw.write(driver.page_source)
|
|
|
+#fw.close()
|
|
|
+#import sys
|
|
|
+#sys.exit()
|
|
|
+
|
|
|
+qlist=[]
|
|
|
+def get_list_from_db2():
|
|
|
+ global qlist
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')
|
|
|
+ query="""SELECT query as kw FROM hhh.gsc_designer where
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/491/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/31/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/293/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/278/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/24/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/594/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/356/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/307/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/491/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/33/1-page/new-sort/') or
|
|
|
+ (`page` = 'https://hhh.com.tw/designers/cases/385/1-page/new-sort/') and position <=10
|
|
|
+ order by impressions/position desc;
|
|
|
+ """
|
|
|
+ cursor=db.query(query)
|
|
|
+ for c in cursor:
|
|
|
+ qlist.append(c['kw'])
|
|
|
+
|
|
|
+
|
|
|
+#### qlist=get_list()
|
|
|
+
|
|
|
+while True:
|
|
|
+ q=random.choice(qlist)
|
|
|
+ prob=random.randint(0,4)
|
|
|
+# prob=random.randint(0,2)
|
|
|
+
|
|
|
+ if prob <=1:
|
|
|
+ # q=qlist[0]
|
|
|
+ print(q)
|
|
|
+ process_query(q)
|
|
|
+ send_msg(q)
|
|
|
+ else:
|
|
|
+ empty_query(q)
|
|
|
+ # intsleep=random.randint(20,40)
|
|
|
+ intsleep=random.randint(7,20)
|
|
|
+# intsleep=random.randint(5,12)
|
|
|
+# intsleep=random.randint(3,6)
|
|
|
+
|
|
|
+ time.sleep(intsleep)
|
|
|
+
|