我正试图从magicbricks.com上获取数据 但是,当我试图通过手动单击页面底部的第二个页面来更改页面时,页面链接保持不变。我得到了同样的数据。如何加载剩余页面
例如: 这是第一页的链接
第二页的链接是相同的,只是页面内容发生了变化
import pandas as pd
from pandas import ExcelWriter
import requests,re,csv
from bs4 import BeautifulSoup
for i in range(1,5): # Number of pages plus one
url = "https://www.magicbricks.com/property-for-sale/residential-
real-estate?bedroom=1,2,3,4,5,%3E5&proptype=Multistorey-
Apartment,Builder-Floor-Apartment,Penthouse,Studio-
Apartment,Residential-House,Villa,Residential-
Plot&cityName=Mumbai".format(i);
r = requests.get(url)
soup = BeautifulSoup(r.content)
我想搜刮这个网站的500个条目
试着用硒来做这个 browser.execute_脚本(“window.scrollTo(0,document.body.scrollHeight);”) 和这段代码一起滚动
相关问题 更多 >
编程相关推荐