I have this html source: https://pastebin.com/F48CiZ6e
I am trying to get the value true from "userIsBlockedViaMessaging" key in the html source provided
I tried the following without luck:
disabled_regex = ad_html_source.body.findAll(text=re.compile('"userIsBlockedViaMessaging"'))
disabled = str(re.compile('"userIsBlockedViaMessaging":(.+),', disabled_regex[0]).group())
If someone could help me out it would mean a lot!
Thanks!
>Solution :
You can use .*? as a regex pattern to search for the text true:
disabled = re.search(r'"userIsBlockedViaMessaging":(.*?),', str(soup)).group(1)
print(disabled)
Output:
true