12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- from typing import NoReturn
- from selenium import webdriver
- import time
- import networkx as nx
- import dataset
- import pickle
- import codecs
- from selenium.webdriver.common import keys
- from selenium.webdriver.common.keys import Keys
- import sys
- import os
- import time
- import re
- import pandas as pd
- import df2sheet
- from browser_common import JBrowser
- import datetime
- import dataset
- #db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')
- def get_designer_statistics():
- global db
- jb=JBrowser()
- data=""
- jb.set_profile_path("Profile 7")
- # googleurl='https://ads.google.com/aw/keywordplanner/'
- # googleurl='https://ads.google.com/aw/overview?ocid=600024232&euid=459838964&__u=6055300436&uscid=600024232&__c=2195332968&authuser=0&subid=ALL-zh-TW-et-g-aw-c-home-awhp_xin1_signin!o2'
- googleurl='https://ads.google.com/aw/keywordplanner/home?ocid=600024232&euid=459838964&__u=6055300436&uscid=600024232&__c=2195332968&authuser=0&subid=ALL-zh-TW-et-g-aw-c-home-awhp_xin1_signin%21o2'
- jb.get(googleurl)
- driver=jb.get_driver()
- time.sleep(40)
- print('after sleep')
- # elmts=driver.find_elements_by_xpath("//div[@class='keyword-text _ngcontent-owh-97']")
- elmts=driver.find_elements_by_xpath("//zippy-icon/..//keyword-text")
- for elmt in elmts:
- print(elmt.text)
- data+=elmt.text+"\n"
- fw=codecs.open('c:/tmp/out.txt','w','utf-8')
- fw.write(data)
- fw.close()
- # print(elmt)
- time.sleep(9999)
- return 'ok'
- get_designer_statistics()
|