I am learning python web scraping and I am testing it and so far its giving me what I need but one record.
Upon checking the id I am testing scraping on is appended by some characters before. e.g.:
id="List_1__firstName"
So I want to get records using part of the id more like %%_firstName
.
_firstName
How do I go about this? This is my current code:
import requests
from bs4 import BeautifulSoup
url = 'https://****.co**/'
headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36'}
page = requests.get(url, headers=headers)
soup = BeautifulSoup(page.content, 'html.parser')
Name = soup.find(id='List_l0_l00_firstName').get_text()
print(Name)