From e57d84b9ac4deb69a071970a823287b33da47ab5 Mon Sep 17 00:00:00 2001 From: Claromes Date: Mon, 14 Aug 2023 17:56:53 -0300 Subject: [PATCH] test lazy loading --- app.py | 23 +---------------------- requirements.txt | 3 +-- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/app.py b/app.py index 41225d0..717b545 100644 --- 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(''.format(link), unsafe_allow_html=True) + st.markdown(''.format(link), unsafe_allow_html=True) st.divider() diff --git a/requirements.txt b/requirements.txt index edfe694..dff5d86 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 -- 2.34.1