Aug-09-2021, 09:01 AM
Hi,
I'd like to list all the visitors who have viewed my Facebook page. For that I use CTR-U to get to my page's HTML code and CTR-F to search for the text "buddy_id" or "name". Both are listed within a <script></script> code and in a dictionary format.
How to strip the html code and get directly to the dictionary content?
TIA
I'd like to list all the visitors who have viewed my Facebook page. For that I use CTR-U to get to my page's HTML code and CTR-F to search for the text "buddy_id" or "name". Both are listed within a <script></script> code and in a dictionary format.
How to strip the html code and get directly to the dictionary content?
TIA
import json filename = 'facebook.txt' # html code try: with open(filename) as f: data = f.read() print("Data type before reconstruction : ", type(data)) # reconstructing the data as a dictionary js = json.loads(data) print("Data type after reconstruction : ", type(js)) print(js) except Exception as e: print('Error msg: ', e) exit() # or return #if an error, exit