我为每个站点的主题分配30个请求。对一些人来说,15-20个请求都是徒劳的。我怎样才能减少这个?你知道吗
我正在使用Python-BeautifulSoup库从一个站点提取数据。你知道吗
The architecture of the site is as follows ( each topic ):
www.abc.com/
www.abc.com/1
www.abc.com/2
www.abc.com/3
www.abc.com/4
www.abc.com/5
www.abc.com/6
for firstTemplate in firstTemplates:
i=1
while i < 30:
sendRequest = requests.get(firstTemplate + str(i))
source = BeautifulSoup(sendRequest.content, "lxml")
i = i + 1
当我查看该网站的所有问题时,平均/数字是25-26。但并非所有线程都是相同的,我将30个请求分配为固定的。例如:www.abc.com/5在30次请求之后。我会不劳而获。我应该写“从循环中提取相同的数据”之类的东西吗?我认为这将提高程序的性能。但我不知道怎么做。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐