import json, re with open('/home/x79/sisvietnamvn_01/BV_DHYD_HCM/Đội ngũ bác sĩ UMC.html', 'r', encoding='utf-8') as f: text = f.read() match = re.search(r'', text) if match: data = json.loads(match.group(1)) props = data['props']['pageProps'] # The specialties might be in pageProps or initialProps # Let's dump all keys to see where it might be def find_key(obj, target, path=""): if isinstance(obj, dict): for k, v in obj.items(): if k == target: print(f"Found {target} at {path}.{k}") if isinstance(v, list) and len(v) > 0 and 'name' in v[0]: print("Names:", [item.get('name') for item in v[:5]]) find_key(v, target, path + "." + k) elif isinstance(obj, list): for i, item in enumerate(obj): find_key(item, target, f"{path}[{i}]") find_key(data, 'departments') find_key(data, 'specialties') # just dump the text of the json and grep for "Da liễu" # Or just use regex to extract the list directly deps_match = re.search(r'\[{"id":\d+,"name":"Khoa.*?}\]', text) if deps_match: print("Regex match for deps:") print(deps_match.group(0)[:500])