Update app.py
Browse files
app.py
CHANGED
@@ -120,16 +120,15 @@ if st.button("Sentiment Analysis", type="secondary"):
|
|
120 |
|
121 |
placeholder.text("Scrolling complete.")
|
122 |
progress_bar.empty()
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
|
|
|
120 |
|
121 |
placeholder.text("Scrolling complete.")
|
122 |
progress_bar.empty()
|
123 |
+
dates = []
|
124 |
+
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#contents #contents")))
|
125 |
+
comments = driver.find_elements(By.CSS_SELECTOR, "#content #content-text")
|
126 |
+
st.write(comments)
|
127 |
+
for comment in comments:
|
128 |
+
comment_text = comment.text #Extract the text from the WebElement
|
129 |
+
date_match = re.search(r'(\d+ (day|week|month|year)s? ago)|(\d{4}-\d{2}-\d{2})', comment_text)
|
130 |
+
if date_match:
|
131 |
+
date_string = date_match.group(0) #Get the matched date string.
|
132 |
+
st.write(date_string) #for debug
|
133 |
+
|
|
|
134 |
|