Skip to content

Commit

Permalink
Bug fixed AttributeError in RE_TKK.search
Browse files Browse the repository at this point in the history
  • Loading branch information
fcoagz authored and c-goosen committed Sep 19, 2024
1 parent 9173ce2 commit 7470d81
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions googletrans/gtoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ def _update(self):
self.tkk = raw_tkk.group(1)
return

code = self.RE_TKK.search(r.text)

if code is not None:
# this will be the same as python code after stripping out a reserved word 'var'
code = code.group(1).replace('var ', '')
# unescape special ascii characters such like a \x3d(=)
code = code.encode().decode('unicode-escape')

try:
# this will be the same as python code after stripping out a reserved word 'var'
code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
Expand Down

0 comments on commit 7470d81

Please sign in to comment.