Skip to content
Advertisement

Web scraping from the span element

I am on a scraping project and I am lookin to scrape from the following.

JavaScript

I want to extract only Christian, Islam as the output.(Without the ‘Faith:’).

This is my try:

JavaScript

How can I make this done?

Advertisement

Answer

There are several ways you can fix this, I would suggest the following – Find all <span> in <div> that have not the class="h5":

JavaScript

Example

JavaScript

Output

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement