MCPcopy
hub / github.com/InstaPy/InstaPy / get_users_from_dialog

Function get_users_from_dialog

instapy/util.py:2271–2297  ·  view source on GitHub ↗

Prepared to work specially with the dynamic data load in the 'Likes' dialog box

(old_data, dialog, logger)

Source from the content-addressed store, hash-verified

2269
2270
2271def get_users_from_dialog(old_data, dialog, logger):
2272 """
2273 Prepared to work specially with the dynamic data load in the 'Likes'
2274 dialog box
2275 """
2276
2277 try:
2278 user_blocks = dialog.find_elements(By.TAG_NAME, "a")
2279 loaded_users = [
2280 extract_text_from_element(u)
2281 for u in user_blocks
2282 if extract_text_from_element(u)
2283 ]
2284 new_data = old_data + loaded_users
2285 new_data = remove_duplicates(new_data, True, None)
2286
2287 return new_data
2288
2289 except (NoSuchElementException, StaleElementReferenceException) as exc:
2290 # Catch stale elements if any
2291 logger.error(
2292 "Error occurred while retrieving data.\n\t{}".format(
2293 str(exc).encode("utf-8")
2294 )
2295 )
2296
2297 return old_data
2298
2299
2300def progress_tracker(current_value, highest_value, initial_time, logger):

Callers 2

get_active_usersFunction · 0.85
likers_from_photoFunction · 0.85

Calls 2

remove_duplicatesFunction · 0.85

Tested by

no test coverage detected