I am trying to collect the chat setting (follower-only-chat / all) in streams, using python.
So far, I tried collecting the data (1) using Twitch Python, which is based on Twitch API; however, after looking into API document I do not think there is any way for me to collect the data using API.
I also tried (2) using requests and BeautifulSoup, but the chat setting won’t appear in the output.
Lastly I tried (3) selenium and use find_elements_by_xpath to extract the chat setting and it did not work – maybe I got it incorrect.
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
try:
# wait for button to be enabled
WebDriverWait(browser, delay).until(
EC.element_to_be_clickable((By.ID, ‘getData’))
)
button = browser.find_element_by_id(‘getData’)
button.click()
# wait for data to be loaded
WebDriverWait(browser, delay).until(
EC.presence_of_element_located((By.CSS_SELECTOR, selector))
)
content = driver.find_elements_by_xpath('/html/body/div[1]/div/div[2]/div/div[2]/div/div[1]/div/div/div/div/div/section/div/div[5]/div[2]/div/button/p')
print(content)
So I was wondering if there is any other ways to collect the stream chat setting.
I tried building a chat bot; however, I am not sure if I can use the chat bot to listen to other channels. The issue I was having was that I would like to collect the chat setting of channels that I do not own. Is this still possible?