fix tweet regex
authorClaromes <claromes@hey.com>
Wed, 16 Aug 2023 21:29:58 +0000 (18:29 -0300)
committerClaromes <claromes@hey.com>
Wed, 16 Aug 2023 21:29:58 +0000 (18:29 -0300)
app.py

diff --git a/app.py b/app.py
index 437ed95c6ffc2a76fa18b7649e28c38a1b93c43a..726c06b3b3b9c446fcd5f9cbbd8cb59a0a21b26f 100644 (file)
--- a/app.py
+++ b/app.py
@@ -37,16 +37,6 @@ hide_streamlit_style = '''
     header[data-testid="stHeader"] {
         opacity: 0.5;
     }
-    div[data-testid="stDecoration"] {
-        visibility: hidden;
-        height: 0%;
-        position: fixed;
-    }
-    div[data-testid="stStatusWidget"] {
-        visibility: hidden;
-        height: 0%;
-        position: fixed;
-    }
     iframe {
         background-color: #dddddd;
         border-radius: 0.5rem;
@@ -95,7 +85,7 @@ def embed(tweet):
         url = 'https://publish.twitter.com/oembed?url={}'.format(tweet)
         response = requests.get(url)
 
-        regex = r'<blockquote class="twitter-tweet"><p[^>]*>(.*?)<\/p>.*?&mdash; (.*?)<\/a>'
+        regex = r'<blockquote class="twitter-tweet"(?: [^>]+)?><p[^>]*>(.*?)<\/p>.*?&mdash; (.*?)<\/a>'
         regex_author = r'^(.*?)\s*\('
 
         if response.status_code == 200 or response.status_code == 302: