Update app.py
Browse files
app.py
CHANGED
@@ -127,11 +127,8 @@ if st.button("Sentiment Analysis", type="secondary"):
|
|
127 |
comments = driver.find_elements(By.CSS_SELECTOR, "#content #content-text")
|
128 |
user_id = 1
|
129 |
for comment in comments:
|
130 |
-
|
131 |
-
|
132 |
-
timestamp = timestamp_element.text
|
133 |
-
except TimeoutException:
|
134 |
-
timestamp = None # Handle the case where the timestamp element isn't found
|
135 |
data.append({"User ID": user_id, "Comment": comment.text, "comment_date": timestamp})
|
136 |
user_id += 1
|
137 |
data = [dict(t) for t in {tuple(d.items()) for d in data}]
|
|
|
127 |
comments = driver.find_elements(By.CSS_SELECTOR, "#content #content-text")
|
128 |
user_id = 1
|
129 |
for comment in comments:
|
130 |
+
timestamp_elements = comment.find_elements(By.CSS_SELECTOR, 'div.author-info > time')
|
131 |
+
timestamp = timestamp_elements[0].get_attribute('datetime') if timestamp_elements else None
|
|
|
|
|
|
|
132 |
data.append({"User ID": user_id, "Comment": comment.text, "comment_date": timestamp})
|
133 |
user_id += 1
|
134 |
data = [dict(t) for t in {tuple(d.items()) for d in data}]
|