nlpblogs commited on
Commit
3d53582
·
verified ·
1 Parent(s): d77506e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -125,9 +125,9 @@ if st.button("Sentiment Analysis", type="secondary"):
125
  try:
126
  wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#contents #contents")))
127
  comment_elements = driver.find_elements(By.CSS_SELECTOR, "#content #content-text")
128
- comment_date_element = driver.find_element(By.XPATH, "//div[@class='author-info']//time")
129
 
130
- timestamp = comment_date_element.get_attribute('datetime') # Get timestamp
 
131
  user_id = 1
132
  for comment_element in comment_elements: # Iterate through comment elements
133
  data.append({"User ID": user_id, "Comment": comment_element.text, "comment_date": timestamp})
 
125
  try:
126
  wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#contents #contents")))
127
  comment_elements = driver.find_elements(By.CSS_SELECTOR, "#content #content-text")
 
128
 
129
+ comment_date_element = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'div.author-info time')))
130
+ timestamp = comment_date_element.get_attribute('datetime')
131
  user_id = 1
132
  for comment_element in comment_elements: # Iterate through comment elements
133
  data.append({"User ID": user_id, "Comment": comment_element.text, "comment_date": timestamp})