Commit 1f951dbf by haojie

1

parent 922a57b6
......@@ -21,7 +21,8 @@ class Dune:
print('元素不存在')
time.sleep(1)
except Exception as e:
print(e)
time.sleep(1)
print('元素不存在')
return False
# 获取元素text
......@@ -103,7 +104,9 @@ class Dune:
f'//*[@id="__next"]/div/main/div[1]/div/section/div/div/article[16]/div/div[1]/table/tbody/tr[{j + 1}]/td[10]/div')
# Transactions(49,636)
obj['Transactions'] = self.getElementText(driver,
f'//*[@id="__next"]/div/main/div[1]/div/section/div/div/article[16]/div/div[1]/table/tbody/tr[{j + 1}]/td[11]/div')
print(obj)
list.append(obj)
if len(list) >= int(num):
# 已爬完
......@@ -126,21 +129,27 @@ class Dune:
options = webdriver.ChromeOptions()
# options.add_argument('headless')
#
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--headless')
options.add_argument(
"user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36")
no_header = True
driver = None
if no_header:
# prod
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--headless')
options.add_argument(
"user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36")
options.add_argument('window-size=1920x1080')
driver = webdriver.Chrome(options=options)
options.add_argument('window-size=1920x1080')
else:
driver = webdriver.Chrome()
driver = webdriver.Chrome(options=options)
# 控制浏览器访问url地址
driver.get("https://dune.com/tyler3/ethscription-indexer?undefined=")
is_show = self.waitElement(driver,
'//*[@id="__next"]/div/main/div[1]/div/section/div/div/article[16]/div/div[1]/table/tbody/tr[1]')
'//*[@id="__next"]/div/main/div[1]/div/section/div/div/article[16]/div/div[1]/table/tbody/tr[1]',
'xpath', 60)
if is_show:
print('元素已出现')
# 总行数
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment