I have the following html code to run a python beautifulsoup to:
<html>
<head>
<script> ... </head>
<title> ... </title>
<style> ... </title>
</head>
<body onload="nextHit()">
S. <a name="hit1"></a><span style="background-color: #FFFF00">NO</span>. 178 H. <a name="hit2"></a><span style="background-color: #FFFF00">NO</span>. 1323 / 46 OG <a name="hit3"></a><span style="background-color: #FFFF00">No</span>. 12, 5977 (December, 1950)
<center>
<h2>...</h2>
<h3>...</h3>
</center>
<br>
....Lines omitted for brevity (more brs, divs, prs)...
</body>
The thing is I only want to get the texts in the beginning of the body tag, just before the first center tag like so:
S. NO. 178 H. NO. 1323 / 46 OG No. 12, 5977 (December, 1950)
I have tried:
ogsourcing = soup.find('center').previousSibling
But I am getting just the last part like so:
. 12, 5977 (December, 1950)