bigget_nft领取脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# coding: utf-8#
import uiautomator2 as u2
import time
from tqdm import tqdm
from loguru import logger
 
def xpath是否存在(xpath,timeout=30):
    for index in range(0,timeout):
        wallet_ele = d.xpath(xpath).exists
        if(wallet_ele):
            logger.success(f"xpath已找到:{xpath}")
            return True
        else:
            logger.debug(f"xpath未找到 {xpath} 等待:{index}")
            time.sleep(1)
    logger.error(f"xpath等待超时:{xpath}是否存在")
    return False
def 领取nft():
    time.sleep(2)
    d(description="首页").click()
    time.sleep(2)
    d(description="赚币中心").click()
    #d.xpath('//*[contains(@content-desc, "新人任务")]').click()
    time.sleep(3)
    d(scrollable=True).scroll.toEnd()
    time.sleep(2)
    d.click(0.806, 0.413)
    d(scrollable=True).scroll.toEnd()
 
    d.xpath('//*[contains(@content-desc, "SecondLive")]//android.view.View[1]').click()
    d(description="以后再说").click_exists()
    claim = xpath是否存在('//*[@content-desc="SecondLive"]')
    if claim:
        d.click(0.501, 0.874)
        time.sleep(5)
 
def click_5s(xpath,timeout=10):
    for index in range(0,timeout):
        wallet_ele = d.xpath(xpath).exists
        if(wallet_ele):
            d.xpath(xpath).click()
            logger.success("成功点击")
            return True
        else:
            logger.debug(f"xpath未找到 {xpath} 等待:{index}")
            time.sleep(1)
    logger.error("点击失败")
    return False
 
 
 
def 添加私钥(privatekey):
    d.app_start("com.bitkeep.wallet", use_monkey=True)
    d(description="暂不开启").click_exists()
    time.sleep(10)
    #d(description="钱包").click()
    #d.xpath('//*[contains(@content-desc, "我")]/android.widget.ImageView[1]').click()
    click_5s('//*[contains(@content-desc, "钱") and contains(@content-desc, "包") and contains(@content-desc, "我")]/android.widget.ImageView[1]')
    d(description="添加钱包").click()
    d(description="助记词/私钥钱包\n支持12位、24位助记词导入或私钥导入").click()
    for index in range(0, 6):
        d(description="0").click()
    time.sleep(5)
    click_5s('//android.widget.EditText')
    time.sleep(2)
    d.send_keys(privatekey, True)
    #d.set_fastinput_ime(False)
    time.sleep(2)
    d(description="确认导入").click()
    #d(scrollable=True).scroll.to(description="Polygon")
    d.xpath('//*[@content-desc="Polygon"]').click()
    d(description="确认").click()
    try:
        d(description="开始探索").click()
    except:
        pass
    return True
if __name__ == '__main__':
    d = u2.connect("22b4097f")
    d.set_fastinput_ime(True)
 
    print(d.info)
    #领取nft()
 
    acc_list =[]
    with open("address.txt","r") as f:
        lines = f.readlines()[300:]
    bar = tqdm(total = len(lines))
    for line in lines:
            line = line.replace("\n","")
            addr,key = line.split("----")
            acc = {
                "private_key": key,
                "address": addr
            }
            acc_list.append(acc)
    for acc in acc_list:
        try:
            add_status = 添加私钥(acc['private_key'])
            if add_status:
                领取nft()
                logger.success(f"{acc['address']}领取nft成功!!!")
                d.app_stop("com.bitkeep.wallet")
                bar.update(1)
        except BaseException as e:
            logger.error(f"{acc['address']}领取nft失败!!! ---- {e}")
        finally:
            try:
                d.app_stop("com.bitkeep.wallet")
            except:
                pass
 
 
# 检查元素是否可点击

  

posted @   冷光清坠落  阅读(42)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
历史上的今天:
2019-03-15 微信公众号开发-java版 腾讯课堂(开发接入)
点击右上角即可分享
微信分享提示