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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -124,13 +124,14 @@ if st.button("Sentiment Analysis", type="secondary"):
124
  data = []
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})
 
134
  user_id += 1
135
  data = [dict(t) for t in {tuple(d.items()) for d in data}] # Remove duplicates
136
 
 
124
  data = []
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
+
130
 
 
 
131
  user_id = 1
132
+ for comment in comments:
133
+ timestamp = driver.find_elements(By.CSS_SELECTOR, 'div.author-info time')
134
+ data.append({"User ID": user_id, "Comment": comment.text, "comment_date": timestamp})
135
  user_id += 1
136
  data = [dict(t) for t in {tuple(d.items()) for d in data}] # Remove duplicates
137