|
@@ -84,7 +84,7 @@ def get_url_list(driver):
|
|
|
# pass
|
|
|
|
|
|
# wait = WebDriverWait(driver, 30)
|
|
|
- # try:
|
|
|
+ # try:地圖移動時更新結果
|
|
|
# wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="ppdPk-Ej1Yeb-LgbsSe-tJiF1e"]')))
|
|
|
# except selenium.common.exceptions.TimeoutException:
|
|
|
# traceback.print_exc()
|
|
@@ -169,6 +169,27 @@ def get_lon_lat_list(db, keyword):
|
|
|
|
|
|
return lst
|
|
|
|
|
|
+def parsing_js(orig):
|
|
|
+ content=""
|
|
|
+ lines=orig.split('\n')
|
|
|
+ for l in lines:
|
|
|
+ newl=l.replace('\\"','"')
|
|
|
+ content+=newl
|
|
|
+ result=re.search(r'\[\["',content)
|
|
|
+ content_begin=result.start()
|
|
|
+
|
|
|
+ result=re.search(r'\]\]"',content)
|
|
|
+ content_end=result.end()
|
|
|
+ jscontent=content[content_begin:content_end-1]
|
|
|
+ jsobj=json.loads(jscontent)
|
|
|
+ print()
|
|
|
+ for x in jsobj[0][1][1:]:
|
|
|
+ print(x[14][11])
|
|
|
+ print(x[14][10])
|
|
|
+ print(x[14][2])
|
|
|
+ print(x[14][78])
|
|
|
+
|
|
|
+
|
|
|
|
|
|
def main():
|
|
|
global chrome_window
|
|
@@ -226,9 +247,18 @@ def main():
|
|
|
print('parsing js:')
|
|
|
resp = brotli.decompress(request.response.body)
|
|
|
jstext=resp.decode('utf-8')
|
|
|
- print(jstext)
|
|
|
- jsobj=json.loads(jstext)
|
|
|
- print(jsobj)
|
|
|
+ parsing_js(jstext)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+# import codecs
|
|
|
+# fw=codecs.open('c:/tmp/ot.json','w','utf-8')
|
|
|
+# fw.write(jstext)
|
|
|
+# fw.close()
|
|
|
+# print(jstext)
|
|
|
+# time.sleep(9999)
|
|
|
+# jsobj=json.loads(jstext)
|
|
|
+# print(jsobj)
|
|
|
# sys.exit()
|
|
|
|
|
|
|