MCPcopy Index your code
hub / github.com/InstaPy/InstaPy / get_shared_data

Function get_shared_data

instapy/util.py:2639–2654  ·  view source on GitHub ↗

Get shared data object from page source Code by schealex :param browser: The selenium webdriver instance :return shared_data: Json data from window._sharedData extracted from page source

(browser)

Source from the content-addressed store, hash-verified

2637
2638
2639def get_shared_data(browser):
2640 """
2641 Get shared data object from page source
2642 Code by schealex
2643
2644 :param browser: The selenium webdriver instance
2645 :return shared_data: Json data from window._sharedData extracted from page source
2646 """
2647 shared_data = None
2648 soup = BeautifulSoup(browser.page_source, "html.parser")
2649 for text in soup(text=re.compile(r"window._sharedData")):
2650 if re.search("^window._sharedData", text):
2651 shared_data = json.loads(re.search("{.*}", text).group())
2652 break
2653
2654 return shared_data

Callers 2

is_private_profileFunction · 0.85
getUserDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected