|
@@ -31,7 +31,7 @@ def restart_browser():
|
|
|
|
|
|
resultdict={'搜尋詞':[],'網域':[],'結果標題':[],'結果網址':[],'結果名次':[]}
|
|
|
|
|
|
-def process_one(term, target, n, sr):
|
|
|
+def process_one(term, target, n, sr, se):
|
|
|
try:
|
|
|
print(term)
|
|
|
|
|
@@ -91,6 +91,8 @@ def process_one(term, target, n, sr):
|
|
|
print("Clicked")
|
|
|
time_stamp = datetime.fromtimestamp(time.time())
|
|
|
time_stamp = time_stamp.strftime("%Y-%m-%d %H:%M:%S")
|
|
|
+ if se==0:
|
|
|
+ table=db['general_log']
|
|
|
table.insert({'ranking':resultrank,'kw':term,'results':count,'url':resultlink,'title':resultttl,'dt':time_stamp})
|
|
|
time.sleep(30)
|
|
|
|
|
@@ -102,9 +104,9 @@ def process_one(term, target, n, sr):
|
|
|
|
|
|
#db_local.close()
|
|
|
|
|
|
-def execute(termlist, target, n, sr):
|
|
|
+def execute(termlist, target, n, sr, se):
|
|
|
for term in termlist:
|
|
|
- process_one(term, "", n, sr)
|
|
|
+ process_one(term, "", n, sr, se)
|
|
|
parser = argparse.ArgumentParser()
|
|
|
parser.add_argument('--loop',action="store_true")
|
|
|
args = parser.parse_args()
|