fork download
  1. import re
  2. from bs4 import BeautifulSoup
  3. MyStr =""" HTML data """
  4. soup = BeautifulSoup(MyStr, "html.parser")
  5. result = re.sub(r'\s+(?:=\s*;\s*)?', ' ', re.search(r'{\s*"\w+".*}', soup.text.decode("utf8"), re.S).group().strip()).replace('&q;= uot;','"')
  6. print(result)
Runtime error #stdin #stdout #stderr 0.09s 119488KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 5, in <module>
AttributeError: 'str' object has no attribute 'decode'