nlpblogs commited on
Commit
a2c8a86
·
verified ·
1 Parent(s): 8338fab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -125,9 +125,11 @@ if st.button("Sentiment Analysis", type="secondary"):
125
  try:
126
  wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#contents #contents")))
127
  comments = driver.find_elements(By.CSS_SELECTOR, "#content #content-text")
128
- timestamp = driver.find_elements(By.XPATH, '//yt-formatted-string[@class="published-time-text style-scope ytd-comment-renderer"]')
129
  user_id = 1
130
  for comment in comments:
 
 
131
 
132
  data.append({"User ID": user_id, "Comment": comment.text, "comment_date": timestamp})
133
  user_id += 1
 
125
  try:
126
  wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#contents #contents")))
127
  comments = driver.find_elements(By.CSS_SELECTOR, "#content #content-text")
128
+
129
  user_id = 1
130
  for comment in comments:
131
+ views = comment.find_element_by_xpath('.//*[@id="metadata-line"]/span[1]').text
132
+ timestamp = comment.find_element_by_xpath('.//*[@id="metadata-line"]/span[2]').text
133
 
134
  data.append({"User ID": user_id, "Comment": comment.text, "comment_date": timestamp})
135
  user_id += 1