我一直在尝试实现一种使用python从网页中获取BTC地址的工具。我尝试了几种正则表达式方法,但不幸的是它们无法正常工作。
def get_bitcoin_address(target, response):
url = target
target = "{0.scheme}://{0.netloc}/".format(urlsplit(url))
res = requests.get(target)
response = BeautifulSoup(res.text, 'html.parser')
bitcoins = re.findall(r'^[123mn][a-km-zA-HJ-NP-Z1-9]{26,33}$', response.text)
print("BTC FOUND: ", len(bitcoins))
for bitcoin in bitcoins:
print("BTC: ", bitcoin)