Skip to content

Instantly share code, notes, and snippets.

@francoisstamant
Created October 7, 2020 21:30
Show Gist options
  • Save francoisstamant/726890c56b074f0de9d21c3e229970c9 to your computer and use it in GitHub Desktop.
Save francoisstamant/726890c56b074f0de9d21c3e229970c9 to your computer and use it in GitHub Desktop.
data=[]
with Chrome(executable_path=r'C:\Program Files\chromedriver.exe') as driver:
wait = WebDriverWait(driver,15)
driver.get("https://www.youtube.com/watch?v=kuhhT_cBtFU&t=2s")
for item in range(200):
wait.until(EC.visibility_of_element_located((By.TAG_NAME, "body"))).send_keys(Keys.END)
time.sleep(15)
for comment in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "#content"))):
data.append(comment.text)
@Fiona30
Copy link

Fiona30 commented Mar 3, 2021

hi, i am a beginner in python and coding, would you mind to share/ add the code on how i can extract the Youtube usernames of the comments as well please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment