Skip to content

Commit

Permalink
v0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
treatmesubj committed Jun 15, 2023
1 parent 24670ef commit ed27a39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

setup(
name="thesr",
version="0.0.5",
version="0.0.6",
license="gpl-3.0",
author="John Hupperts",
author_email="jrock4503@hotmail.com",
description="thesaurus (and also dictionary)",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/treatmesubj/Thesaurus_Rex",
download_url="https://github.com/treatmesubj/Thesaurus_Rex/archive/refs/tags/v0.0.5.tar.gz",
download_url="https://github.com/treatmesubj/Thesaurus_Rex/archive/refs/tags/v0.0.6.tar.gz",
packages=["thesr"],
package_dir={"Thesaurus_Rex": "thesr"},
project_urls={
Expand Down
9 changes: 4 additions & 5 deletions thesr/thesr.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,16 @@ def get_syns_ants(word):
response.text,
"html.parser",
)
script = re.search(
r"<script>[\s\S]*window\.INITIAL_STATE = (.+);[\s\S]*</script>", soup.prettify()
).group(1)
script_elem = soup.select_one("script#preloaded-state")
script = re.search(r"window.__PRELOADED_STATE__ = ({.*})", script_elem.text).group(1)
# clean JSON
script = script.replace(":undefined", ':"undefined"')
script = script.replace(":null", ':"null"')

j = json.loads(script)
sanjay = json.loads(script)

try:
posTabs = j["searchData"]["tunaApiData"]["posTabs"]
posTabs = sanjay['tuna']['resultsData']['definitionData']['definitions']
except TypeError:
return

Expand Down

0 comments on commit ed27a39

Please sign in to comment.