test lazy loading
authorClaromes <claromes@hey.com>
Mon, 14 Aug 2023 20:56:53 +0000 (17:56 -0300)
committerClaromes <claromes@hey.com>
Mon, 14 Aug 2023 20:56:53 +0000 (17:56 -0300)
app.py
requirements.txt

diff --git a/app.py b/app.py
index 41225d0387797cb6fec09ace15d91a33490593de..717b545db3f3d3f4a27cc7521663f075781c98fc 100644 (file)
--- a/app.py
+++ b/app.py
@@ -4,8 +4,6 @@ import streamlit as st
 import streamlit.components.v1 as components
 import json
 import re
-import os
-from selenium import webdriver
 
 __version__ = '0.2'
 
@@ -276,27 +274,8 @@ if query or handle:
                 if mimetype[i] == 'text/html':
                     st.error('Tweet has been deleted.')
 
-                    re_link = re.search(r'[^/]+$', link)
-                    re_link = re_link.group()
-                    screenshot_filename = 'img_{}.jpg'.format(re_link)
-
-                    if not os.path.exists(screenshot_filename):
-                        options = webdriver.ChromeOptions()
-                        options.add_argument('--headless')
-
-                        driver = webdriver.Chrome(options=options)
-                        driver.get(link)
-                        driver.set_window_size(700, 700)
-
-                        current_directory = os.getcwd()
-                        screenshot_path = os.path.join(current_directory, screenshot_filename)
-
-                        driver.save_screenshot(screenshot_path)
-                        driver.quit()
-
-                    st.image(screenshot_filename)
                     # components.iframe(link, height=500, width=700)
-                    st.markdown('<iframe src="{}" loading="lazy" height=500 width=auto></iframe>'.format(link), unsafe_allow_html=True)
+                    st.markdown('<iframe src="{}" loading="lazy" height=500 width=auto></iframe>'.format(link), unsafe_allow_html=True)
 
                     st.divider()
 
index edfe694b7efe41d46ebe11caa795b130b92a2c18..dff5d86e24b756c9ce7b2d569c541b2112a0b2c6 100644 (file)
@@ -1,3 +1,2 @@
 requests==2.30.0
-streamlit==1.25.0
-selenium==4.11.2
\ No newline at end of file
+streamlit==1.25.0
\ No newline at end of file