How would I get the value of the game being played from a streamers stream: ? Example stream: https://www.twitch.tv/xqcow
this is the code I have now:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
driver = webdriver.Chrome()
driver.get('https://www.twitch.tv/xqcow')
html = driver.page_source
soup = BeautifulSoup(html, features="html.parser")
game = soup.select_one("a data-a-target")
print(game)
CodePudding user response:
The title is under the class kLnQWs
.
You can use the following CSS selector:
game = soup.select_one("span.kLnQWs").text
print(game)
Output:
Fall Guys: Ultimate Knockout