Retrieving the text output of a html website using bs4

Viewed 23

I am currently trying to extract the text of what match name I have scraped.

import pandas as pd
import requests
from bs4 import BeautifulSoup
import re

url = 'https://www.betexplorer.com/odds-movements/soccer/'

res = requests.get(url)
soup = BeautifulSoup(res.content, "lxml")
times = soup.select('span.table-main__time') #good
matches = soup.find_all("td",class_ ="table-main__tt")

Output

I have located the tag/class and it seems the value i want to retrieve is behind the href in the a tag. the output I wish to achieve here is 'Can Tho - Long An'

this is a dynamic webpage so its likely that the same output for match wont be possible but I am looking for pointers on how I can extract just the text and not the whole html.

1 Answers

why you don't use lxml it's the best method for web scraping

Related