Я очищаю страницу, используя Python & bs4
Исходный код html, полученный от bs4, выглядит следующим образом (немного очищен для удобства чтения):
<p style="text-align:justify;font-size:12.0px;font-family:Arial, Helvetica, sans-serif">
<span style="font-size:14.0px"><span style="font-family:Arial, Helvetica, sans-serif">
<strong>COMPANY DESCRIPTION</strong><br>
Here goes the first para of company description</span></span></p>
<p style="text-align:justify;font-size:12.0px;font-family:Arial, Helvetica, sans-serif">
<span style="font-size:14.0px"><span style="font-family:Arial, Helvetica, sans-serif">
Here goes the second para of company description</span></span></p>
<p><strong>PURPOSE AND OBJECTIVES</strong></p>
<p>To address requirements in the area of Supply Chain Management Extended Warehouse Management solutions, Build competencies at Solution Delivery Center to deliver solutions<br>
<strong>EXPECTATIONS AND TASKS </strong></p>
<ul>
<li>Independently handle large implementation projects with focus on Warehouse Management processes such as inbound, outbound and internal processes. RF Device functions and Barcode support experience is desirable</li>
<li>Able to lead EWM discussions, assessments and detail requirement studies with customers</li>
</ul>
<strong>KEY PERFORMANCE INDICATORS</strong></p>
<ul>
<li>Customer Feedback/customer satisfaction scores</li>
<li>Productive days/utilization as defined by the organization for projects/assessments/etc.</li>
<li>Knowledge Management and creation of effective reusable components</li>
</ul>
<strong>EXPERIENCE REQUIREMENTS</strong></p>
<ul>
<li>Minimum of 4+ years industry experience and a minimum of 5 to 6 years of SAP EWM experience</li>
<li>Domain knowledge in Supply Chain Management in the areas of Planning, Manufacturing & warehousing processes is a must</li>
</ul>
<p><strong>EDUCATION AND QUALIFICATIONS/SKILLS AND COMPETENCIES</strong></p>
<ul>
<li>Degree in Engineering or IT</li>
<li>SAP Certification in Extended Warehouse Management (EWM) desirable</li>
</ul>
<p><span style="font-family:Arial,Helvetica,sans-serif"><span style="font-size:14.0px"><strong>WHAT YOU GET FROM US </strong></span></span></p>
Замечания:
В вышеприведенном коде все заголовки разделов находятся между <strong> </strong>
тегами. Заголовки могут отличаться на разных страницах.
Мое требование:
- Чтобы объединить все тексты и теги html, начиная с тега 2nd
<strong>
после ОПИСАНИЕ КОМПАНИИ, т.е. от ЦЕЛИ И ЦЕЛЕЙ, и заканчивается перед тегом, содержащим «ЧТО ВЫ ПОЛУЧАЕТЕ ОТ НАС». - Я не ищу никакого решения, использующего Селен, поскольку оно будет сравнительно медленным.
Страница, которую я очищаю, Ссылка, которую я очищаю
Вот мой кусок python код:
def scrape_url(url, method='bs4'):
session = requests.session()
page = session.get(url)
soup = BeautifulSoup(page.text, 'html.parser')
return soup
url = 'https://jobs.sap.com/job/Mumbai-Senior-Account-Executive-Job-MH/539212101/'
soup = scrape_url(url)
job_page = soup.body.find('div', attrs={'class': 'job'})
print(job_page)