mercredi 25 novembre 2020

Python - Filter BS4 content

Current code:

import bs4
import requests

url = 'hidden'

res = requests.get(url)

soup = bs4.BeautifulSoup(res.text, 'html.parser')
bs4_content = soup.find_all(class_='user-post-count')
print(bs4_content)

Only content I manage to get is

[<p class="user-post-count">This user has made <strong>5 posts</strong>
</p>] 

I'm trying to only get the content between the strong tags.

Thank you, all help much appreciated




Aucun commentaire:

Enregistrer un commentaire