bradley6597 commited on
Commit
ad38218
1 Parent(s): 17afdf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -3,6 +3,7 @@ import pandas as pd
3
  import requests
4
  import re
5
  import json
 
6
 
7
  english_dict = pd.read_csv("dictionary.txt",
8
  header = None,
@@ -30,12 +31,14 @@ def spell_bee_solver(no_centre, centre):
30
  return(final_word_df)
31
 
32
  def get_spellbee_answers(x):
 
 
33
  content = requests.get(url)._content
34
  content = re.sub(".*window.games = ", "", str(content))
35
  content = re.sub("(.*?)\\;.*", "\\1", content)
36
- print(content)
37
  content = json.loads(content)
38
- valid_words = content['data']['dictionary']
 
39
  final_word_df = pd.DataFrame(valid_words, columns = ['word'])
40
  final_word_df['word_length'] = final_word_df['word'].str.len()
41
  final_word_df = final_word_df[final_word_df['word_length'] > 3]
 
3
  import requests
4
  import re
5
  import json
6
+ from datetime import date
7
 
8
  english_dict = pd.read_csv("dictionary.txt",
9
  header = None,
 
31
  return(final_word_df)
32
 
33
  def get_spellbee_answers(x):
34
+ today = date.today().strftime("%Y-%m-%d")
35
+
36
  content = requests.get(url)._content
37
  content = re.sub(".*window.games = ", "", str(content))
38
  content = re.sub("(.*?)\\;.*", "\\1", content)
 
39
  content = json.loads(content)
40
+
41
+ valid_words = content[today]['data']['dictionary']
42
  final_word_df = pd.DataFrame(valid_words, columns = ['word'])
43
  final_word_df['word_length'] = final_word_df['word'].str.len()
44
  final_word_df = final_word_df[final_word_df['word_length'] > 3]