Let's save you some time, instead of rewriting or using crappy converters
do the below:
Run pip install js2py
Create translater.py
Write in translater.py:
import js2py
js2py.translate_file("js_file.js", "name_of_translated_file.py")
Run translater.py
remove translater.py
You can remove the original js file
Then in any python file:
from name_of_translated_file_without_.py import *
functionorstufffromtranslated()
Exemple:
original (coolpackage.js):
var hello = function(){
return "Hello world!"
}
translater.py:
import js2py
js2py.translate_file("coolpackage.js", "coolpackage.py")
Run translater.py
remove coolpackage.js
a python script (main.py):
from coolpackage import *
print(coolpackage.hello())
run main.py
>>Hello world!