Link to home
Start Free TrialLog in
Avatar of Scarlett72
Scarlett72

asked on

BS4 web scraper can't get text values from named class in <div>

BS4 web scraper can't get text values from named class in <div>

Hi I am trying to use Beautifulsoup to get a value from a web field. I can get normal <div> tags but I don't get any results when I try to parse data from a named class in a <div> tag. Can anyone tell me what I am doing wrong?

from urllib.request import urlopen as ureq
from bs4 import BeautifulSoup as soup
from requests import get
import urllib
from bs4 import BeautifulSoup
my_url = 'https://www.padmapper.com/apartments/toronto-on'
uClient = ureq(my_url)
page_html = uClient.read()
page_soup = soup(page_html, "html.parser")

list_item = page_soup.find_all("div", {"class":"ListItemMobile_text__2IIjF"})
for ls in list_item:
print(ls.get_text())
uClient.close()

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Juan Carlos
Juan Carlos
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial