Is There Any Way To Extract The Value Of P/E Ration In The Given Html Code From A Web Page

I am working on a web scrapping project and I need to extract the value of P/E from the given html code through a website. This has to be dynamic in nature. The ticker I have used is IDEA and I am also enclosing the code I have used. I also want to extract values of sales growth for 1 year, 3 year and 5 year from the HTML code next to the below html code.

This on is for PE ratio

<div class="col-6 col-md-4 compess">
                                <small>P/E<span class="infolink" data-tooltip="tooltip" title="" data-original-title="It is a valuation parameter that measures the company's current share price relative to its per-share earnings. Generally, high P/E is Overvalued &amp; low P/E is Undervalued."><svg class="svg-inline--fa fa-info-circle fa-w-16" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="info-circle" role="img" xmlns="" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"></path></svg><!-- <i class="fas fa-info-circle"></i> --></span></small>

This is for the sales growth

<div class="w-100">
                            <div class="ratiosingle"><span class="duration">1 Year</span><span class="durationvalue">-27.09%</span></div><div class="ratiosingle"><span class="duration">3 Year</span><span class="durationvalue">-5.38%</span></div><div class="ratiosingle"><span class="duration">5 Year</span><span class="durationvalue">1.05%</span></div>

 import pandas as pd
    from bs4 import BeautifulSoup
    import requests
    a=input("Enter symbol of the company\n")
    CP = soup.find("div", {"id":"mainContent_clsprice"}).find("span", {"class": "Number"}).getText()


You could try something like this:

import requests
from bs4 import BeautifulSoup

with requests.Session() as session:
    for ticker in ['IDEA', 'TIMEXWATCH', 'OFSS']:
        (r := session.get(f'{ticker}')).raise_for_status()
        soup = BeautifulSoup(r.content, 'lxml')
        pe = soup.find(id='mainContent_updAddRatios').find_all('div')[3].find('p').text.strip()
        print(f'P/E for {ticker} = {pe}')