-1

我正在尝试从这个特定的 URL 抓取交易:https ://etherscan.io/token/generic-tokentxns2?m=normal&contractAddress=0x8a40c222996f9f3431f63bf80244c36822060f12&a=&sid=806e09ccf69cba25a7a6f8b1d4629a66&p=1

我按照其他 StackOverflow 查询的说明进行操作:如何构建 Etherscan webscraper?

只是为了方便参考,我的代码是这样的:

from urllib.request import Request, urlopen
from bs4 import BeautifulSoup as soup
import pandas as pd

url2 = 'https://etherscan.io/token/generic-tokentxns2?m=normal&contractAddress=0x8a40c222996f9f3431f63bf80244c36822060f12&a=&sid=806e09ccf69cba25a7a6f8b1d4629a66&p=1'

req2 = Request(url2, headers={'User-Agent':'my-app/0.0.1'})
response2 = urlopen(req2, timeout=30).read()
response_close2 = urlopen(req2, timeout=20).close()
page_soup2 = soup(response2, "html.parser")

但是,从下面的屏幕截图中可以看出,会返回一个错误页面: 在此处输入图像描述

The weird thing is I did the same for another URL (top token holders) - https://etherscan.io/token/generic-tokenholders2?m=normal&a=0x8a40c222996f9f3431f63bf80244c36822060f12&s=150000000000000000000000000&sid=806e09ccf69cba25a7a6f8b1d4629a66&p=1 - and it works fine:

在此处输入图像描述

有人可以建议吗?谢谢!

4

0 回答 0