Amrrs commited on
Commit
d5fc687
1 Parent(s): 1d9cdbb

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests # this is to GET the javascript
2
+ import re # this is to do regular expression and extract the list of words
3
+ import streamlit as st #web app development
4
+
5
+
6
+ m = st.markdown("""
7
+ <style>
8
+ div.stButton > button:first-child {
9
+ background-color: #0000FF;
10
+ color:#ffffff;
11
+ }
12
+ div.stButton > button:hover {
13
+ background-color: #FF0000;
14
+ color:##ff99ff;
15
+ }
16
+ </style>""", unsafe_allow_html=True)
17
+
18
+ # extract the wordle solution list from the source page javascript
19
+
20
+ @st.cache
21
+ def extract_solution():
22
+
23
+ wordle_js = requests.get("https://www.powerlanguage.co.uk/wordle/main.c1506a22.js")
24
+
25
+ m = re.findall(r"var La=\[(.*?)\]", wordle_js.text, flags=re.S)
26
+
27
+ word_list = m[0].split(",")
28
+
29
+ return(word_list)
30
+
31
+ word_list = extract_solution()
32
+
33
+ st.title("👻 Wordle Spoiler 👿")
34
+
35
+ index = st.text_input(label = "Enter the Wordle Number for which you need solution")
36
+
37
+ st.error(" ⚠️ Do you really want to do this? I mean you can always play for fun!!!")
38
+
39
+ if st.button("Yes I just want to spoil the mood",):
40
+ st.balloons()
41
+ st.write(word_list[int(index)])