0

I am trying the following code but not getting anything inside section tag

page = requests.get('https://www.iplt20.com/match/2018/20?tab=scorecard')
soup = BeautifulSoup(page.content, 'html.parser')
soup.find_all('section', {'class':'contentTab tab3 scorecardContent'})

I am getting the following result:
[<section class="contentTab tab3 scorecardContent" id="scorecardContent" style="display:none"></section>]

Below is the section tag:
Section Tag

I checked and found that the content/text I want is in innerText but I am not able to fetch it

innerText

Please help, how can I get the details as shown in innerText?

Rajat Gupta
  • 72
  • 1
  • 13

1 Answers1

1

You can do it with RequestsHTML:

Code:

from requests_html import HTMLSession

session = HTMLSession()
r = session.get('https://www.iplt20.com/match/2018/20?tab=scorecard')
r.html.render()

tab3 = r.html.find('#scorecardContent', first=True)
print(tab3.text)

Output:

Sunrisers Hyderabad Innings (Run Rate: 8.90)
Batsmen
Runs
...
radzak
  • 2,986
  • 1
  • 18
  • 27