【发布时间】:2022-01-05 05:02:47
【问题描述】:
我正在尝试对该网站https://www.edgeprop.sg/condo-apartment/aquarius-by-the-park 进行网络抓取,以获取概览表中的土地面积(平方米)。结果应该给我 40,608
但是,我无法得到我想要的结果。这是我的代码:
#[Python] test webscrape on edgeprop
import gspread
import json
from oauth2client.service_account import ServiceAccountCredentials
from openpyxl.worksheet import worksheet
from requests.api import request
import requests
import time
from requests.models import Response
import scrapy
from bs4 import BeautifulSoup
from six import add_metaclass, class_types
query_string='https://www.edgeprop.sg/condo-apartment/aquarius-by-the-park'
resp = requests.get(query_string)
soup = BeautifulSoup(resp.content,'html.parser')
print("soup is: ", query_string)
try:
landsize = soup.find_all("h4",class_="detail-title__text")
print("Landsize is: ", landsize)
except IndexError:
pass
【问题讨论】:
标签: python web-scraping beautifulsoup python-requests