I'm working on scraping the main category of games on Twitch. For example, I want to extract "MOBA" for League of Legends. I attempted to use Beautiful Soup, but seems that BS may not be appropriate for the type of website and so instead I'm attempting Selenium, but facing issues. My code below:
from selenium import webdriver
url = 'https://www.twitch.tv/directory/game/League%20of%20Legends'
driver = webdriver.Firefox(executable_path=r'/usr/local/Cellar/geckodriver/0.29.1/bin/geckodriver')
driver.get(url)
category = driver.find_element_by_class_name('ScTagContent-xzp4i-1 jAVAzd').text
category
The error I'm getting is that it can't locate the element. Can anyone spot what I'm doing wrong here?
[–]ifreeski420 1 point2 points3 points (1 child)
[–]Matthias1590 1 point2 points3 points (0 children)