nlpblogs commited on
Commit
bacc29e
·
verified ·
1 Parent(s): ea96c2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -125,10 +125,12 @@ 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
  user_id = 1
129
  for comment in comments:
130
- timestamp = datetime.now().strftime("%Y-%m-%d")
131
- data.append({"User ID": user_id, "Comment": comment.text, "comment_date": timestamp.text})
132
  user_id += 1
133
  data = [dict(t) for t in {tuple(d.items()) for d in data}]
134
  except Exception as e:
 
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
+ timestamp1 = driver.find_element(By.CSS_SELECTOR,'div.author-info time')
129
+ timestamp = timestamp1.get_attribute('datetime'))
130
  user_id = 1
131
  for comment in comments:
132
+
133
+ data.append({"User ID": user_id, "Comment": comment.text, "comment_date": timestamp})
134
  user_id += 1
135
  data = [dict(t) for t in {tuple(d.items()) for d in data}]
136
  except Exception as e: