简体   繁体   中英

BeautifulSoup can't read HTML of the webpage

I want to get real estate data from https://www.realtor.com/

I use this code:

from bs4 import BeautifulSoup as bs
import requests

main_url='https://www.realtor.com/realestateandhomes-search/New-York_NY'

page=requests.get(main_url).content
bs(page,'html.parser')

It does not output the full HTML of the page, so can't find the tags I am interested in.

Is there another way to get the full HTML?

import requests

main_url='https://www.realtor.com/realestateandhomes-search/New-York_NY'

page=requests.get(main_url)
results = bs(page.content,'html.parser')
print(results)

This should work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM