I have an html file with content I can't extract easily with BeautifulSoup because I think it is loaded with Javascript.
..."inlineParams":"json","title":"","lNameP":"MYNAME","key":"degree_result_person"},"firstName":"MYFIRSTNAME"...
I have multiples names in this file that I would like to extract. Those names are just after "lNameP". Is there any way to do a loop to get all those names (in this case i would like to get MYNAME) ?
Thanks a lot,
This regex code will match exactly what you need:
string ='"inlineParams":"json","title":"","lNameP":"MYNAME","key":"degree_result_person"},"firstName":"MYFIRSTNAME"'
import re
pattern = re.compile('\"lNameP"\:"(.*?)"')
match = pattern.search(string).group(1)
print (match)
Output:
MYNAME