I want to print out all the IDs from a page which has a unique class.
The page what I want to scrape with Beautiful Soup is like this:
<div itemscope itemprop="item" itemtype="http://schema.org/Product" id="12345" class="realestate">
<div class="contentArea">
<meta itemprop="name" content="Name - 12345 " />
<meta itemprop="url" content="https://url12345.hu" />
<meta itemprop="category" content="category1" />
</div>
</div>
<div itemscope itemprop="item" itemtype="http://schema.org/Product" id="12346" class="realestate">
<div class="contentArea">
<meta itemprop="name" content="Name - 12346 " />
<meta itemprop="url" content="https://url12346.hu" />
<meta itemprop="category" content="category1" />
</div>
</div>
the 'ID' is a unique identifier from the Itemscope DIVs, so somehow I want to extract these uniques IDs and print all of them out (the reson is to attach all other ad information to this ID (like name, URL, etc.) later)
I tried with this python code, but it does not work.
import requests
from bs4 import BeautifulSoup
page = requests.get('searchResultPage.url')
soup = BeautifulSoup(page.text, 'html.parser')
id = soup.find_all('id')
print(id)
It gives back an empty list.
What I expect, and what I want is to get back a list with the ID-s from the divs, this way: 12345 12346
Thanks for your help in advance!